Spring ApplicationListener no recibe eventos
Tengo el siguiente ApplicationListener:
package org.mycompany.listeners;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextStartedEvent;
public class MyApplicationListener implements ApplicationListener<ContextStartedEvent> {
public MyApplicationListener() {
super();
System.out.println("Application context listener is created!");
}
/**
* {@inheritDoc}
*/
public void onApplicationEvent(final ContextStartedEvent event) {
System.out.println("Context '" + event.getApplicationContext().getDisplayName() + "' is started!");
}
}
Y la siguiente definición de bean:
<bean name="myApplicationListener" class="org.mycompany.listeners.MyApplicationListener" />
Puedo ver que el bean se crea cuando se imprime el mensaje del constructor, pero el evento de inicio de contexto nunca se recibe. ¿Qué me estoy perdiendo