2020
10-07
10-07
Spring ApplicationListener的使用详解
介绍SpringApplicationListener是Spring事件机制的一部分,与ApplicationEvent抽象类结合完成ApplicationContext的事件通知机制.ContextRefreshedEvent事件监听以Spring的内置事件ContextRefreshedEvent为例,当ApplicationContext被初始化或刷新时,会触发ContextRefreshedEvent事件.如下代码示例:@ComponentpublicclassLearnListenerimplementsApplicationListener<ContextRefreshedEvent>{@OverridepublicvoidonAppl...
继续阅读 >