ApplicationListener
利用容器机制获取容器内的bean
@Configuration
public class ContextRefreshedListener implements ApplicationListener<ContextRefreshedEvent> {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
// Spring根容器
if(event.getApplicationContext().getParent()==null){
Map<String,Object> beans = event.getApplicationContext().getBeansWithAnnotation(PermissionFilter.class);
System.err.println("=====ContextRefreshedEvent====="+event.getSource().getClass().getName());
}
}
}