2017-06-29 45 views
3

我嘗試使用Spring HATEOAS中的EntityLinks概念。ApplicationEventMulticaster未使用Spring HATEOAS初始化

EntityLinks is available for dependency injection by activating @EnableEntityLinks in your Spring MVC configuration.

我這樣做,就是這樣:

@Configuration 
@EnableEntityLinks 
@ComponentScan(basePackages = { "de.sample.test" }) 
public class WebMvcConfig extends WebMvcConfigurerAdapter { 
     ... 
} 

現在,如果我啓動應用程序,我得到以下錯誤:

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot[email protected]7869d479: startup date [Thu Jun 29 13:42:58 CEST 2017]; root of context hierarchy

沒有註釋的應用程序啓動,但我沒有EntityLinks支持。

有什麼建議嗎?在此先感謝

回答

1

我簡單忘記data-rest-webmvc依賴項。這在我所遵循的教程中沒有提及。

<dependency> 
    <groupId>org.springframework.data</groupId> 
    <artifactId>spring-data-rest-webmvc</artifactId> 
</dependency> 
相關問題