applicationContext由BeanFactory派生,这样大家都知道他从他那老爸那继承的方法.
1,同时他又实现了MessageSource(国际化),国际化吗,不有解析了,具体参见:org.springframework.context.support.ResourceBundleMessageSource
具体应用
java 代码
- MessageSource source=new ClassPathXmlApplictionContext("xxxbean.xml");
- String message=resource.getMessage("message",null,"Default",null);
那么就能从property里面取出那个message的值出来了.
2,载入多个上下文;
3,资源访问,如字符串,URL等
4,事件传播,实现ApplicationListener接口的bean
最常用的如MVC
在web.xml定义
java 代码
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>classPath*:xxxx.xml</param-value>
- </context-param>
定义contextLoadListenter
java 代码
- <listener>org.springframework.web.context.ContextLoaderListener</listerner>
这样就把spring的bean加载进去了.
下班了,先回家,下次接着说资源Resource
再下来就引入到Application context和Resource路径
本文介绍了Spring框架中ApplicationContext接口的功能及其实现,包括消息源国际化、加载多个上下文、资源访问和事件传播等内容,并提供了具体的使用示例。
528

被折叠的 条评论
为什么被折叠?



