Spring的servlet context和application context
Spring lets you define multiple contexts in a parent-child hierarchy.
The applicationContext.xml defines the beans for the "root webapp context", i.e. the context associated with the webapp.
The spring-servlet.xml (or whatever else you call it) defines the beans for one servlet's app context. There can be many of these in a webapp, one per Spring
servlet (e.g. spring1-servlet.xml for servlet spring1, spring2-servlet.xml for servlet spring2).
Beans in spring-servlet.xml can reference beans in applicationContext.xml, but not vice versa.
All Spring MVC controllers must go in the spring-servlet.xml context.
In most simple cases, the applicationContext.xml context is unnecessary. It is generally used to contain beans that are shared between all servlets in
a webapp. If you only have one servlet, then there's not really much point, unless you have a specific use for it.
另外,servlet context只在servet被init()的时候加载,各servlet的context相互独立,包括URL映射规则什么的都是独立的~~~
最新文章
- 基于jquery封装通用的控制显示隐藏的方法
- swift基础:第三部分:对第一部分的补充说明
- 【OpenGL】如何绘制Shadow
- js DOM优化相关探索
- Java---Java的面试题(一)
- Team Homework #2 Decide the roles of each team member ——IloveSE
- 【英语】Bingo口语笔记(12) - Put系列
- 【转载】Apache kafka原理与特性(0.8V)
- 相册弹窗(基于zepto.js)
- PC-删除共享[绝对够狠的方法]
- Mysqldb连接Mysql数据库(转)
- 安卓handler.post问题
- (转)openURL的使用方法
- java 上传2(使用java组件fileupload和uploadify)
- Struts 1 之<;html>;标签库
- python实现将字符串中以大写字母开头的单词前面添加“_”下划线
- Java多线程(十)——线程优先级和守护线程
- JAVA使用Tess4J进行ocr识别
- 将某视图View转换为UIImage
- Eclipse导入git上的maven web项目 部署 - lpshou
热门文章
- leetcode@ [274/275] H-Index &; H-Index II (Binary Search &; Array)
- 纯CSS3实现的图片滑块程序,效果非常酷
- Keil C51汉字显示的bug问题
- UVa 127 - ";Accordian"; Patience
- js难点之闭包理解
- Windows 环境下基于 Redis 的 Celery 任务调度模块的实现
- 查看linux中的TCP连接数【转】
- jdbc连接的工具类
- 原生js操作cookie
- cocos2d-x 添加纹理自动回收机制