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映射规则什么的都是独立的~~~

最新文章

  1. 基于jquery封装通用的控制显示隐藏的方法
  2. swift基础:第三部分:对第一部分的补充说明
  3. 【OpenGL】如何绘制Shadow
  4. js DOM优化相关探索
  5. Java---Java的面试题(一)
  6. Team Homework #2 Decide the roles of each team member ——IloveSE
  7. 【英语】Bingo口语笔记(12) - Put系列
  8. 【转载】Apache kafka原理与特性(0.8V)
  9. 相册弹窗(基于zepto.js)
  10. PC-删除共享[绝对够狠的方法]
  11. Mysqldb连接Mysql数据库(转)
  12. 安卓handler.post问题
  13. (转)openURL的使用方法
  14. java 上传2(使用java组件fileupload和uploadify)
  15. Struts 1 之<html>标签库
  16. python实现将字符串中以大写字母开头的单词前面添加“_”下划线
  17. Java多线程(十)——线程优先级和守护线程
  18. JAVA使用Tess4J进行ocr识别
  19. 将某视图View转换为UIImage
  20. Eclipse导入git上的maven web项目 部署 - lpshou

热门文章

  1. leetcode@ [274/275] H-Index & H-Index II (Binary Search & Array)
  2. 纯CSS3实现的图片滑块程序,效果非常酷
  3. Keil C51汉字显示的bug问题
  4. UVa 127 - "Accordian" Patience
  5. js难点之闭包理解
  6. Windows 环境下基于 Redis 的 Celery 任务调度模块的实现
  7. 查看linux中的TCP连接数【转】
  8. jdbc连接的工具类
  9. 原生js操作cookie
  10. cocos2d-x 添加纹理自动回收机制