ApplicationListener :父类EventListener,用于被应用的事件监听器实现,基于{@code java.util.EventListener} 接口的观察者模式的实现,从Spring3.0开始ApplicationListener可以声明它感兴趣的事件类型,当在Spring ApplicationContext中注册时,将相应地过滤事件,只调用侦听器来匹配事件对象。
void onApplicationEvent(E event);处理应用程序事件。
ApplicationListener 配置在classpath*:META-INF/spring.factories的配置文件中,取属性KEY=org.springframework.context.ApplicationContextInitializer的值,如图: