spring boot 监听容器启动

/**
 * 在容器启动的时候 加载没问完成的消息重发
 * @author zhangyukun
 *
 */
@Component
@Slf4j
public class LoadMessageListener implements ApplicationListener<ContextRefreshedEvent>,Ordered {

	@Autowired
	QueueMessageService queueMessageService;
	
	@Override
	public int getOrder() {
		return Integer.MAX_VALUE;
	}

	@Override
	public void onApplicationEvent(ContextRefreshedEvent event) {
		log.debug("初始化为完成的的消息.................");
		queueMessageService.initLoadUnSucceed();
	}

}

  

posted on 2019-10-16 11:58  zhangyukun  阅读(591)  评论(0编辑  收藏  举报

导航