`
leon.s.kennedy
  • 浏览: 111951 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

BeanFactory or ApplicationContext

 
阅读更多

Users are sometimes unsure whether a BeanFactory or an ApplicationContext is best suited for use in a particular situation. A BeanFactory pretty much just instantiates and configures beans. An ApplicationContext also does that, and it provides the supporting infrastructure to enable lots of enterprise-specific features such as transactions and AOP.

In short, favor the use of an ApplicationContext.

 

The org.springframework.beans and org.springframework.context packages provide the basis for the Spring Framework's IoC container. The BeanFactory interface provides an advanced configuration mechanism capable of managing objects of any nature. The ApplicationContextinterface builds on top of the BeanFactory (it is a sub-interface) and adds other functionality such as easier integration with Spring's AOP features, message resource handling (for use in internationalization), event propagation, and application-layer specific contexts such as theWebApplicationContext for use in web applications.

In short, the BeanFactory provides the configuration framework and basic functionality, while the ApplicationContext adds more enterprise-centric functionality to it. The ApplicationContextis a complete superset of the BeanFactory, and any description of BeanFactory capabilities and behavior is to be considered to apply to the ApplicationContext as well.

This chapter is divided into two parts, with the first part covering the basic principles that apply to both the BeanFactory and ApplicationContext, and with the second part covering those features that apply only to the ApplicationContext interface

ApplicationContext提供了更多的方法

分享到:
评论

相关推荐

    spring-framework-reference4.1.4

    Not Using Commons Logging ................................................................... 12 Using SLF4J ..............................................................................................

    spring-framework-reference-4.1.2

    Not Using Commons Logging ................................................................... 12 Using SLF4J ..............................................................................................

    java dubbo admin 2.5.3 + jdk1.7

    java dubbo admin 2.5.3 + jdk 1.7 亲试 好用 ... java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

    Spring的refresh()方法相关异常解析

    BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext 这个异常消息是说 BeanFactory 对象没有初始化或已经关闭了,使用 ApplicationContext 获取 ...

    百度持续交付项目组面试题

    // swap arr[i+1] and arr[high] (or pivot) int temp = arr[i + 1]; arr[i + 1] = arr[high]; arr[high] = temp; return i + 1; } } ``` **输入n个整数,输出其中最小的k个** 这个问题可以通过构建一个...

Global site tag (gtag.js) - Google Analytics