java面试题

当前位置: 面试问题网 > java面试题 > spring中的BeanFactory与ApplicationContext的作用和区别

spring中的BeanFactory与ApplicationContext的作用和区别

作用:
   1. BeanFactory负责读取bean配置文档,管理bean的加载,实例化,维护bean之间的依赖关系,负责bean的声明周期。
   2. ApplicationContext除了提供上述BeanFactory所能提供的功能之外,还提供了更完整的框架功能:
   a. 国际化支持
   b. 资源访问:Resource rs = ctx. getResource(“classpath:config.properties”), “file:c:/config.properties”
   c. 事件传递:通过实现ApplicationContextAware接口
   3. 常用的获取ApplicationContext的方法:
   FileSystemXmlApplicationContext:从文件系统或者url指定的xml配置文件创建,参数为配置文件名或文件名数组
   ClassPathXmlApplicationContext:从classpath的xml配置文件创建,可以从jar包中读取配置文件
   WebApplicationContextUtils:从web应用的根目录读取配置文件,需要先在web.xml中配置,可以配置监听器或者servlet来实现
  
   org.springframework.web.context.ContextLoaderListener
  
  
   context
   org.springframework.web.context.ContextLoaderServlet
   1
  
   这两种方式都默认配置文件为web-inf/applicationContext.xml,也可使用context-param指定配置文件
  
   contextConfigLocation
   /WEB-INF/myApplicationContext.xml
  

【spring中的BeanFactory与ApplicationContext的作用和区别】相关文章

1. spring中的BeanFactory与ApplicationContext的作用和区别

2. Spring中ApplicationContext的作用是什么

3. Spring里面applicationContext.xml文件能不能改成其他文件名

4. 如何在web环境中配置applicationContext.xml文件

5. 什么是Connection-oriented Protocol/Connectionless Protocol面向连接的协议/无连接协议

6. Spring对多种ORM框架提供了很好的支持,简单描述在Spring中使用Hibernate的方法

7. 简述你对Statement,PreparedStatement,CallableStatement的理解

8. 了解AppleShare protocol(AppleShare协议)吗

9. 介绍一下ICMP(Internet Control Message Protocol)Internet控制信息协议

10. what is the difference between ext2 and ext3

本文来源:https://www.mianshiwenti.com/a12605.html

点击展开全部

《spring中的BeanFactory与ApplicationContext的作用和区别》

将本文的Word文档下载到电脑,方便收藏和打印

推荐程度:

进入下载页面

﹝spring中的BeanFactory与ApplicationContext的作用和区别﹞相关内容

「spring中的BeanFactory与ApplicationContext的作用和区别」相关专题

其它栏目

也许您还喜欢