package com.finance.applicationListener;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
public class InstantiationTracingBeanPostProcessor implements ApplicationListener<ContextRefreshedEvent> {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
log.error("web容器加载onApplicationEvent启动。。。。。。");
/**
* 当存在父子容器时,此判断很有用
*/
final ApplicationContext app = event.getApplicationContext();
if (null == app.getParent()
&& "Root WebApplicationContext".equals(app.getDisplayName())) {
init();
}else{
init();
}
}
private void init(){
}
}