Spring加载完成后调用方法

public class MyRequest implements ApplicationListener<ContextRefreshedEvent>{
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        // 系统启动后加载该方法  
        if(event.getApplicationContext().getParent() == null){
             /*  */
        }
    }
    
}


<bean class="com.xxx.MyRequest "/>   

猜你喜欢

转载自even-ing.iteye.com/blog/2287709