/**
* 在容器启动的时候 加载没问完成的消息重发
* @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 监听容器启动的更多相关文章

  1. Spring Boot 监听 Activemq 中的特定 topic ,并将数据通过 RabbitMq 发布出去

    1.Spring Boot 和 ActiveMQ .RabbitMQ 简介 最近因为公司的项目需要用到 Spring Boot , 所以自学了一下, 发现它与 Spring 相比,最大的优点就是减少了 ...

  2. 【串线篇】spring boot嵌入式Servlet容器启动原理;

    什么时候创建嵌入式的Servlet容器工厂?什么时候获取嵌入式的Servlet容器并启动Tomcat: 获取嵌入式的Servlet容器工厂: 1).SpringBoot应用启动运行run方法 2).r ...

  3. 【Spring Boot】Spring Boot之五种容器启动后进行相关应用初始化操作方法

    一.方式一,使用ApplicationListener<E extends ApplicationEvent>监听ContextRefreshedEvent事件 /** * @author ...

  4. spring扩展点之三:Spring 的监听事件 ApplicationListener 和 ApplicationEvent 用法,在spring启动后做些事情

    <spring扩展点之三:Spring 的监听事件 ApplicationListener 和 ApplicationEvent 用法,在spring启动后做些事情> <服务网关zu ...

  5. Spring Boot 容器选择 Undertow 而不是 Tomcat Spring Boot 内嵌容器Unde

    Spring Boot 内嵌容器Undertow参数设置 配置项: # 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程 # 不要设置过大,如果过大,启动 ...

  6. Spring Boot 嵌入式Web容器

    目录 前言 1.起源 2.容器启动流程解析 2.1.获取应用类型 2.2.容器启动流程 3.加载 Web 容器工厂 4.总结 前言         最近在学习Spring Boot相关的课程,过程中以 ...

  7. 简单消息监听容器--SimpleMessageListenerContainer

    这个类非常强大,我们可以对他做很多设置,对于消费者的配置项,这个类都可以满足监听队列(多个队列).自动启动.自动声明功能可以设置事务特性.事务管理器.事务属性.事务容量(并发).是否开启事务.回滚消息 ...

  8. Spring Boot 2 (七):Spring Boot 如何解决项目启动时初始化资源

    Spring Boot 2 (七):Spring Boot 如何解决项目启动时初始化资源 在项目启动的时候需要做一些初始化的操作,比如初始化线程池,提前加载好加密证书等.今天就给大家介绍一个 Spri ...

  9. Spring事件监听Demo

    Spring事件监听实现了观察者模式.本Demo在junit4测试环境中实现 主要有三个类事件类.监听器类.事件发布类(入口) 事件类必须继承 ApplicationEvent,代码如下: impor ...

随机推荐

  1. 使用R语言 SDK调取tushare数据

    安装Tushare 打开RStudio,在控制台输入命令: > install.packages('Tushare') Tushare的R包需要依赖httr.tidyverse.forecast ...

  2. 4-MySQL高级-事务-提交(3)

    提交 为了演示效果,需要打开两个终端窗口,使用同一个数据库,操作同一张表 step1:连接 终端1:查询商品分类信息 select * from goods_cates; step2:增加数据 终端2 ...

  3. eclipse新建maven项目和聚合项目

    1.new maven project :  next 2.勾选 create a simple project  :  next 3.Group Id:项目的包路径 如com.jiayou.zjl, ...

  4. Spark运行架构设计

  5. 06.Mybatis关联查询

    1.一对一关联查询 需求:查询出每条orders记录和其关联的user信息 在orders实体类中添加属性与set.get方法 /** * 测试1对1关联查询 */ private User user ...

  6. Buy Low, Buy Lower

    Buy Low, Buy Lower 给出一个长度为N序列\(\{a_i\}\),询问最长的严格下降子序列,以及这样的序列的个数,\(1 <= N <= 5000\). 解 显然我们可以很 ...

  7. BeanPostProcessor原理--使用讲解

    <Spring源码解析>笔记 BeanPostProcessor原理学习 在学习BeanPostProcessor的原理学习完之后,对Spring如何使用充满好奇,尝试使用例子进行理解,以 ...

  8. 模拟求root——cf1067B

    注意最后一轮要单独求一下 且最后只能有一个root #include <bits/stdc++.h> using namespace std; #define MOD 1000000007 ...

  9. prometheus配置详情

    https://prometheus.io/docs/prometheus/latest/configuration/configuration/ 下面监控宿主机和容器的内存,CPU,磁盘等状态 gr ...

  10. LUOGU P4322 [JSOI2016]最佳团体(0/1分数规划+树形背包)

    传送门 解题思路 一道0/1分数规划+树上背包,两个应该都挺裸的,话说我常数为何如此之大..不吸氧洛谷过不了啊. 代码 #include<iostream> #include<cst ...