spring初始化

* Created by litao on 15/12/29.
*/
@Component("initTagDataProcessor")
public class InitTagDataProcessor implements ApplicationListener<ContextRefreshedEvent> {
private static Logger logger=Logger.getLogger(InitTagDataProcessor.class);

@Autowired
private AppTagCollectionService appTagCollectionService;

@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if(event.getApplicationContext().getParent() == null){//root application context 没有parent,他就是老大.
//初始化tag
logger.info("start init tag data");
appTagCollectionService.loadTagData();
logger.info("finish init tag data");
}
}
}

上一篇:[SQL]一个删选数据的例子,使用GROUP、DISTINCT


下一篇:Objective-C 编码风格指南