2017-06-29 113 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>