package com.sanss.monitor.server.task;
import java.util.ArrayList;
import javax.annotation.Resource;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
public class DefaultJob implements ApplicationListener<ContextRefreshedEvent>{
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if(event.getApplicationContext().getParent() == null){
//代码
}
}
}
<!-- 需要Spring容器加载这个Bean -->
<bean class="com.sanss.monitor.server.task.DefaultJob"/>