项目启动加载缓存
来源:互联网 发布:金馆长ps软件 编辑:程序博客网 时间:2024/05/16 11:36
Tomcat启动时加载数据到缓存--Web.xml里listener的加载顺序,优先初始化Spring IOC容器
多个listener加载顺序
- <listener>
- <listener-class>
- org.springframework.web.context.ContextLoaderListener
- </listener-class>
- </listener>
- <listener>
- <listener-class>
- com.wsjiang.test.listener.CacheListener
- </listener-class>
- </listener>
- public class ContextLoaderListenerOverWrite extends ContextLoaderListener {
- private IStationService stationService;
- private IOSCache osCache;
- @Override
- /**
- * @description 重写ContextLoaderListener的contextInitialized方法
- */
- public void contextInitialized(ServletContextEvent event) {
- super.contextInitialized(event);
- ApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
- //获取bean
- stationService = (IStationService) applicationContext.getBean("stationService");
- osCache = (IOSCache) applicationContext.getBean("osCache");
- /*
- 具体地业务代码
- */
- }
- }
- <listener>
- <listener-class>
- com.wsjiang.test.listener.ContextLoaderListenerOverWrite
- </listener-class>
- </listener>
0 0
- 项目启动加载缓存
- spring项目中监听器作用-ContextLoaderListener(项目启动时,加载一些东西到缓存中)
- spring项目中监听器作用-ContextLoaderListener(项目启动时,加载一些东西到缓存中)
- spring项目中监听器作用-ContextLoaderListener(项目启动时,加载一些东西到缓存中)
- spring启动时加载缓存中数据
- Web服务器启动时加载缓存
- tomcat启动不加载项目
- VS2012启动/加载项目出问题
- web项目 启动加载顺序
- Tomcat启动是项目没加载进去
- SpringMVC项目中启动自加载Listener
- Java web项目启动加载顺序
- Java Web项目启动加载顺序
- java web项目启动即加载类
- Java EE 项目启动加载顺序
- 项目启动,无法加载Spring xsd文件
- eclipse启动tomcat不加载项目
- 转--项目启动时加载自定义properties
- weblogic com.sun.jersey.spi.inject.Errors.ErrorMessagesException:null
- sublime安装插件不能安装上的一些解决方法
- 人脸识别性别识别 csv文件生成
- CentOS下的mysql安装
- 计算机基础之牛客网刷题第四篇
- 项目启动加载缓存
- OKHttp使用示例翻译和个人理解
- ubuntu kylin16.10谷歌输入法输入不了中文的解决办法
- python正则表达式简述
- centos7之lamp环境搭建
- 巧用mybatis 的<foreach>标签的 index 属性解决批量排序值问题
- Java反射机制demo
- git的基本使用方法
- HDU_2176 取(m堆)石子游戏