my EventListener
annotation don't receive any Spring Event. Here is my code:
@Component
public class ProxyConfig {
public ProxyConfig() {
System.out.println("I can see this in the console");
}
@EventListener
public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
System.out.println("WON'T WORK :-("); // FIXME
}
@EventListener
public void test(ApplicationStartedEvent event) {
System.out.println("WON'T WORK :-("); // FIXME
}
}
And here is my Application
class:
@SpringBootApplication
public class Application {
public static void main(String[] args) throws Exception {
SpringApplication.run(MyApp.class, args);
}
}
According to https://spring.io/blog/2015/02/11/better-application-events-in-spring-framework-4-2 and https://solidsoft.wordpress.com/2015/09/29/annotation-driven-event-listeners-in-spring-4-2/ it must be working, but it still not print my "WON'T WORK :-(" String :(
Any idea?
Thanks!
Application
andProxyConfig
in? – JonsonApplication
is in packagecom.mycompany.app
. AndProxyConfig
is in a subpacke:com.mycompany.app.configuration.impl
– FrontolysisMETA-INF/spring.factories
file (see docs.spring.io/spring-boot/docs/current/reference/html/…) it works without the Annotations, but not with... :( – Frontolysis