springboot 编写启动时监听服务
来源:互联网 发布:淘宝店铺怎么投诉 编辑:程序博客网 时间:2024/06/06 18:06
/** * Created by Administrator on 2017/9/5. * @desc 启动时的监听服务 */public class ApplicationStartup implements ApplicationListener<ContextRefreshedEvent> { private final static Logger log = LogManager.getLogger(ApplicationStartup.class); @Override public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { try { log.debug("ApplicationStartup初始化开始"); ApplicationContext context = contextRefreshedEvent.getApplicationContext(); //redis服务 RedisService redisService = context.getBean(com.lixy.crm.crm_tsale_kx_service.service.impl.RedisServiceImpl.class); //字典服务 SysDictionaryInfoService dictionaryInfoService = (SysDictionaryInfoService)context.getBean(com.kuaixin.crm.crm_tsale_kx_service.service.impl.SysDictionaryInfoServiceImpl.class); //初始化系统字典 Map<String, String> map = dictionaryInfoService.getMapForkeyToValue(); if(map!=null&&map.size()>0) redisService.setMapValueByMapAndKey(BConstants.SYS_DICTIONARY_KEY_VALUE_MAP, map); log.debug("ApplicationStartup初始化完成"); } catch (Exception e) { log.error("服务初始化异常:", e); } }}
@Configuration@SpringBootApplication@EnableScheduling@EnableDiscoveryClient@MapperScan("com.lixy.crm.*.mapper")@Mapper@ServletComponentScan// 扫描Servletpublic class App{ public static void main(String[] args) throws Exception { SpringApplication application = new SpringApplication(App.class); application.setDefaultProperties(XConfProperty.getProperties()); //添加监听到启动应用 application.addListeners(new ApplicationStartup()); ApplicationContext context = application.run(args); SpringContextUtil.setApplicationContext(context); }}
阅读全文
0 0
- springboot 编写启动时监听服务
- oracle11g监听服务启动时提示“oracle监听服务启动后停止”的错误处理方法
- oracle10g 监听服务无法启动
- oracle10g 监听服务无法启动
- Oracle监听服务无法启动
- Oracle--启动监听及服务
- 监听服务启动不起来
- cmd启动Oracle服务和监听服务
- SpringBoot启动服务的三种方式
- Springboot-启动 Spring Boot服务的方式
- 编写脚本启动Windows服务
- 编写linux服务启动脚本
- Oracle 监听服务不能启动处理方法
- Oracle监听服务启动失败怎么办
- Linux环境下启动Oracle监听服务
- win7 oracle 无法启动 OracleOraDb10g_home1TNSListener 服务 监听
- oracle 监听服务无法启动的问题
- linux下启动oracle服务与监听
- 绝对路径和相对路径的选择
- 双向循环链表长整数加法(大数加减法)
- <linux线程>同步互斥机制之【条件变量】
- python3 下载图片
- linux中history的小技巧
- springboot 编写启动时监听服务
- Hibernate_映射继承关系
- centos7下mysql5.7忽略表名大小写
- 多线程面试题
- lua面试
- SharedPreferences自动登录判断
- 23种设计模式(5):原型模式
- Mybatis配置文件中<mappers>配置方式
- CountDownLatch同步辅助类简用