I want to handle multiple events in one class, here's my example:
@Lazy(false)
@Component
public class EventListenerImpl {
@EventListener
public void handleContextRefreshedEvent(ContextRefreshedEvent event) {
LOGGER.log(event.getSource());
...
}
}
However this method is not being executed when my application starts.
In my applicationContext.xml
I have:
<context:annotation-config/>
<context:component-scan base-package="..."/>
which should be enough for @EventListener
to work, according to the documentation.
The old way of implementing ApplicationListener<ContextRefreshedEvent>
works just fine.
I'm using Spring 4.2.4.RELEASE.
<context:annotation-driven/>
in your XML? – Borehole<context:component-scan/>
instead which should be enough according to docs: docs.spring.io/spring/docs/current/javadoc-api/org/… – PincashandleContextRefreshed
see here: spring.io/blog/2015/02/11/… – BoreholeThat didn't help.
? – BoreholehandleContextRefresh
and I have redeployed the application. – Pincas