第1步:创建一个系统监听,要求是这个监听必须最后加载
第2步:在监听启动代码中,获得ApplicatioinContext的引用,代码如下:
public void contextInitialized(ServletContextEvent contextEvent) {
ServletContext servletContext= contextEvent.getServletContext();
ApplicationContext ctx=WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
}
详细解决方案
在Web工程中取得ApplicationContext的简易方法
热度:94 发布时间:2012-10-09 10:21:45.0
相关解决方案
- applicationContext.xml怎么和JAVA代码关联
- SSH项目,applicationcontext.xml加载问题
- Spring Web项目中 ApplicationContext 的获取跟创建Bean的过程1
- Web施用中自动加载 ApplicationContext
- web 代码中 怎么获得 applicationcontext 及与 beanfactory 区别
- Spring 中 ApplicationContext 、WebApplicationContext跟 BeanFactory比较
- [/WEB-INF/applicationContext.xml]解决办法
- applicationContext.xml 配置文件的一些认识解决思路
- applicationContext。xml配置数据库密码包孕特殊字符
- applicationContext.xml中的这些都是什么东西?该如何解决
- 求java 获取 ApplicationContext.xml属性的步骤
- applicationContext.xml配置有关问题
- applicationContext.xml 配置有关问题
- applicationContext.xml里org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
- [applicationContext.xml]: Initialization of bean failed;
- idea上使用maven分模块开发时解决spring注入失败问题java.lang.IllegalStateException: Failed to load ApplicationContext
- spring3 ApplicationContext bean spring
- ApplicationContext 用法
- ApplicationContext.xml的两种配置方式
- class path resource [applicationContext.xml] cannot be opened because it does not exist
- springboot启动报错Error starting ApplicationContext