ApplicationEventMulticaster 未使用 Spring HATEOAS 初始化
ApplicationEventMulticaster not initialized with Spring HATEOAS
我尝试使用 Spring HATEOAS 中的 EntityLinks 概念。
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.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7869d479: startup date [Thu Jun 29 13:42:58 CEST 2017]; root of context hierarchy
没有注释,应用程序启动,但我没有 EntityLinks 支持。
有什么建议吗?提前致谢
我只是忘记了 data-rest-webmvc 依赖项。我遵循的教程中没有提到这一点。
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-webmvc</artifactId>
</dependency>
我尝试使用 Spring HATEOAS 中的 EntityLinks 概念。
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.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7869d479: startup date [Thu Jun 29 13:42:58 CEST 2017]; root of context hierarchy
没有注释,应用程序启动,但我没有 EntityLinks 支持。
有什么建议吗?提前致谢
我只是忘记了 data-rest-webmvc 依赖项。我遵循的教程中没有提到这一点。
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-webmvc</artifactId>
</dependency>