Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ApplicationEventMulticaster not initialized with Spring HATEOAS

I try to use the EntityLinks concept from Spring HATEOAS.

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

I do it just like that:

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

Now if I start the application I get the following error:

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

Without the annotation the application starts but I have no EntityLinks support.

Any suggestions? Thanks in advance

like image 600
Manu Zi Avatar asked Feb 20 '26 20:02

Manu Zi


1 Answers

I simple forget the data-rest-webmvc dependency. That wasn't mention in the tutorials I followed.

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-rest-webmvc</artifactId>
</dependency>
like image 67
Manu Zi Avatar answered Feb 23 '26 10:02

Manu Zi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!