I want to handle multiple events in one class, here is my example:
@Lazy(false)
@Component
public class EventListenerImpl {
@EventListener
public void handleContextRefreshedEvent(ContextRefreshedEvent event) {
LOGGER.log(event.getSource());
...
}
}
However, this method does not execute when my application starts.
In mine applicationContext.xml
I have:
<context:annotation-config/>
<context:component-scan base-package="..."/>
which should be sufficient to work @EventListener
in accordance with the documentation.
The old implementation method ApplicationListener<ContextRefreshedEvent>
works fine.
I am using Spring 4.2.4.RELEASE.
source
share