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映射规则什么的都是独立的~~~
Spring的servlet context和application context的更多相关文章
- Android开发之Android Context,上下文(Activity Context, Application Context)
转载:http://blog.csdn.net/lmj623565791/article/details/40481055 1.Context概念Context,相信不管是第一天开发Android,还 ...
- Spring Boot 核心配置文件 bootstrap & application
Spring Boot 核心配置文件 bootstrap & application 1.SpringBoot bootstrap配置文件不生效问题 2.bootstrap/ applicat ...
- interface21 - web - ContextLoaderListener(Spring Web Application Context加载流程)
前言 最近打算花点时间好好看看spring的源码,然而现在Spring的源码经过迭代的版本太多了,比较庞大,看起来比较累,所以准备从最初的版本(interface21)开始入手,仅用于学习,理解其设计 ...
- 【spring mvc】application context的生命周期
上一次讲application context中bean的生命周期,后面贴了一部分代码,但根本没理解代码意思,有幸在博客园看到一篇关于这部分的代码解析,特别长,特此做了一些整理笔记,并附上链接:htt ...
- Spring < context:annotation-config> 、< context:component-scan>、< mvc:annotation-driven />注解配置
Spring 中在使用注解(Annotation)会涉及到< context:annotation-config> 和 < context:component-scan>配置, ...
- [Spring Unit Testing] Spring Unit Testing with a Java Context
For example, we want to test against a implemataion: package com.example.in28minutes.basic; import o ...
- Spring 梳理-Spring配置文件 -<context:annotation-config/>和<context:component-scan base-package=""/>和<mvc:annotation-driven /> 的区别
<context:annotation-config/> 在基于主机方式配置Spring时,Spring配置文件applicationContext.xml,你可能会见<contex ...
- 【异常】The dependencies of some of the beans in the application context form a cycle
一.异常出现场景以及异常信息 场景:SpringBoot中自定义DataSource数据源 异常信息: -- :: --- [ main] o.s.b.d.LoggingFailureAnalysis ...
- Spring 开启Annotation <context:annotation-config> 和 <context:component-scan>诠释及区别
<context:annotation-config> 和 <context:component-scan>的区别 <context:annotation-config& ...
随机推荐
- HW6.18
public class Solution { public static void main(String[] args) { double[] array = {6.0, 4.4, 1.9, 2. ...
- Tcp/Ip协议族简单解读及网络数据包/报/帧数据格式及封装及解包;
http://www.creseek.cn/products-install/install_on_bsd_linux/ 中文检索 离线cloudera ecosystem components: h ...
- 第十三章、学习 Shell Scripts 善用判断式
善用判断式 利用 test 命令的测试功能 我要检查 /dmtsai 是否存在时,使用: [root@www ~]# test -e /dmtsai [root@www ~]# test -e /dm ...
- js为表格添加行和列
<table id="studentTable" align="center" border="1px;" cellpadding=& ...
- 3.x的触摸响应机制
第一种是采用函数回调,主要是用于MenuItem [cpp] view plaincopy // a selector callback void menuCloseCallback(Object* ...
- NGUI学习笔记(三):屏幕自适应
我们开发移动端游戏的时候,一般都会选择Constrained/FixedSize的缩放模式来保证图片在不同的分辨率下相对于屏幕的尺寸保持一致,但是对于屏幕自适应来说,这还是不够的,不同的手机存在不同的 ...
- 【新闻】超灵敏MRI技术:照亮人体肺部
人口健康直接影响到一个国家的经济发展和社会进步.据我国2013年发布的肿瘤发病率统计年报表明,肺癌是我国目前首位恶性肿瘤,是癌症死亡的头号杀手,目前城市中每4名死亡的癌症患者中,约有1名是肺癌.如何开 ...
- C# Winform 支持Hex与ASCII输入和切换的文本框
最近一直在做一个支持串口,TCP,UDP通讯调试的一体化工具(也就是C#串口调试工具 v2.0的第三版),其中涉及到16进制数据和ASCII码的输入,所以继承了TextBox的基础上,写了这个支持He ...
- 我的AndroidStudio设置
转载:http://stormzhang.com/devtools/2014/11/25/android-studio-tutorial1/ 官方下载有两个地方,均需要FQ. Android Deve ...
- SCOM随笔
1.在监控群集资源时,安装完agent后,在代理管理-agent属性中选中“允许此代理充当代理并发现其他计算机上的托管对象” 如果监控DC的话,也要选中该选项