Spring Context及ApplicationContext
web.xml
这是声明了一个父工厂
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/conf/*.xml</param-value>
</context-param>
servlet
这是声明了一个子工厂
<servlet>
<servlet-name>SpringMVC</servlet-name>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-mvc.xml</param-value>
</init-param>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>0</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>SpringMVC</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping> 子工厂可以引用父工厂中的bean 通过实现
org.springframework.context.ApplicationContextAware的
setApplicationContext(ApplicationContext applicationContext)方法可以通过applicationContext的
getBeanDefinitionNames()获得所有的bean。
getParent()获得context的父context。
Spring Context及ApplicationContext的更多相关文章
- spring context上下文(应用上下文webApplicationContext)(转载)
(此文转载:http://www.cnblogs.com/brolanda/p/4265597.html) 一.先说ServletContext javaee标准规定了,servlet容器需要在应用项 ...
- Spring context:component-scan中使用context:include-filter和context:exclude-filter
Spring context:component-scan中使用context:include-filter和context:exclude-filter XML: <?xml version= ...
- Spring context:component-scan代替context:annotation-config
Spring context:component-scan代替context:annotation-config XML: <?xml version="1.0" encod ...
- spring BeanFactory及ApplicationContext中Bean的生命周期
spring bean 的生命周期 spring BeanFactory及ApplicationContext在读取配置文件后.实例化bean前后.设置bean的属性前后这些点都可以通过实现接口添加我 ...
- spring中获取applicationContext
常用的5种获取spring 中bean的方式总结: 方法一:在初始化时保存ApplicationContext对象代码:ApplicationContext ac = new FileSystemXm ...
- Spring的配置文件ApplicationContext.xml配置头文件解析
Spring的配置文件ApplicationContext.xml配置头文件解析 原创 2016年12月16日 14:22:43 标签: spring配置文件 5446 spring中的applica ...
- 使用web.xml方式加载Spring时,获取Spring context的两种方式
使用web.xml方式加载Spring时,获取Spring context的两种方式: 1.servlet方式加载时: [web.xml] <servlet> <servlet-na ...
- 【转】 spring context解惑
转自:http://blog.csdn.net/c289054531/article/details/9196149?utm_source=tuicool&utm_medium=referra ...
- 【报错】spring整合activeMQ,pom.xml文件缺架包,启动报错:Caused by: java.lang.ClassNotFoundException: org.apache.xbean.spring.context.v2.XBeanNamespaceHandler
spring版本:4.3.13 ActiveMq版本:5.15 ======================================================== spring整合act ...
随机推荐
- NOJ 1012 进制转换(十进制转换成随意进制)
题目: 进制转换 时间限制(普通/Java) : 1000 MS/ 3000 MS 执行内存限制 : 65536 KByte总提交 : 1819 測试通过 : ...
- python list.remove(),del()和filter & lambda
面试题之中的一个. 下面代码能执行吗? l = [1,2,3,4,5] for i in range(0,len(l)): print i if l[i] % 2 == 0: del l[i] pri ...
- 0054 Spring MVC的@Controller和@RequestMapping注解
@Controller注解 该注解用来指示一个类是一个控制器,在Spring的配置xml文件中开启注解扫描 <context:conponent-scan base-package=" ...
- [转]RPC、CORBA、WebService之区别
RPC是由Sun发明的远程过程调用协议,是第一种真正的分布式应用模型.Windows上使用的R PC是DCERPC的扩展.严格地说,RPC是一种逻辑上的协议,它可以使用Socket.Named Pip ...
- c# 遇到的问题,求解?
c# cannot evaluate expression because the code of the current method is optimized.
- python练习题4-判断日期是一年的第几天
题目:输入某年某月某日,判断这一天是这一年的第几天? 程序分析:以3月5日为例,应该先把前两个月的加起来,然后再加上5天即本年的第几天,特殊情况,闰年且输入月份大于2时需考虑多加一天: 程序源代码: ...
- 猫猫学iOS 之微博项目实战(5)微博自己定义搜索框searchBar
猫猫分享.必须精品 原创文章.欢迎转载. 转载请注明:翟乃玉的博客 地址:http://blog.csdn.net/u013357243 一:效果 用UITextField简单定义一个搜索框 二:调用 ...
- gm: error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory
安装gm库产生问题 解决方案: # cat /etc/ld.so.confinclude ld.so.conf.d/*.conf# echo "/usr/local/lib" &g ...
- Docker是用来干什么的?【快速入门】
Docker从去年开始不仅能在Linux下运行 ,还支持windows.osX等主流系统. 下面的例子我自己经常使用,当然你有更好的案例也可以分享给我. 尝试新软件 对开发者而言,每天会催生出的各式各 ...
- js 数组取出最大值最小值和平均值的方法
1.直接遍历数组 ,,,,,,,]; ]; ;i<arr.length;i++){ if(max<arr[i]) max=arr[i]; } 2.借用Math的方法 ,,,,,,,]; v ...