spring controller中获取webApplicationContext
来源:互联网 发布:网络销售茶叶好做吗 编辑:程序博客网 时间:2024/06/05 10:58
可以在controller中使用WebApplicationContext获取
可以获取到web.xml中param-name的值
<context-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/spring/root-context.xml</param-value></context-param>
WebApplicationContext webApplicationContext =ContextLoader.getCurrentWebApplicationContext(); String contextConfigLocation = webApplicationContext.getServletContext().getInitParameter("contextConfigLocation");
使用ServletContext获取
ServletContext servletContext=request.getSession().getServletContext();WebApplicationContext webApplicationContext = (WebApplicationContext)servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
0 0
- spring controller中获取webApplicationContext
- 从servlet中获取spring的WebApplicationContext
- Spring 中获取servletContext及WebApplicationContext
- Spring 中获取servletContext及WebApplicationContext
- Spring 中获取servletContext及WebApplicationContext
- Spring 中获取servletContext及WebApplicationContext
- Spring中WebApplicationContext
- Struts2获取Spring的WebApplicationContext
- spring拿到WebApplicationContext,获取bean
- Spring中WebApplicationContext的研究
- Spring中WebApplicationContext的研究
- Spring中WebApplicationContext的研究
- Spring中WebApplicationContext的研究
- Spring中WebApplicationContext的研究
- Spring中WebApplicationContext的研究
- Spring中WebApplicationContext的研究
- Spring中WebApplicationContext的研究
- Spring中WebApplicationContext的研究
- web.xml中load-on-startup标签的含义
- MyBatis 入门到精通(二) SQL语句映射XML文件
- [BZOJ1211][HNOI2004][prufer序列][排列]树的计数
- 做seo的人必须知道的十个关键词
- 计算机网络可靠性的影响因素
- spring controller中获取webApplicationContext
- linux之awk用法
- 为Laravel的artisan指令增加bash脚本
- php百度搜索某地天气的小偷代码
- MyBatis 入门到精通(三) 高级结果映射
- maven管理本地jar包
- 美媒:强强联手 优酷马铃薯华为抢占互联网电视商场
- 邻接矩阵求有向图各顶点的入度和出度 (图论基础)
- 查找算法总结(一)