spring boot 监听容器启动

Posted 张玉坤

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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();
	}

}

  

以上是关于spring boot 监听容器启动的主要内容,如果未能解决你的问题,请参考以下文章