spring5.1.1源码剖析之BeanFactory接口

栏目: Java · 发布时间: 6年前

内容简介:The org.springframework.beans and org.springframework.context packages are the basis for Spring Framework’s IoC container. The BeanFactory interface provides an advanced configuration mechanism capable of managing any type of object. ApplicationContext is

The org.springframework.beans and org.springframework.context packages are the basis for Spring Framework’s IoC container. The BeanFactory interface provides an advanced configuration mechanism capable of managing any type of object. ApplicationContext is a sub-interface of BeanFactory。

org.springframework.beansorg.springframework.context 两个包是Spring框架IoC

容器的基础。BeanFactory接口为任何类型提供了高级配置能力。ApplicationContext是BeanFactory的子接口,它提供了以下功能:

  1. Easier integration with Spring’s AOP features

    (与Spring AOP特性的简单集成)

  2. Message resource handling (for use in internationalization) (处理Message resource,用于国际化)

  3. Event publication (事件发布)

  4. Application-layer specific contexts such as the WebApplicationContext for use in web applications. (应用层指定上下文,比如Web应用的WebApplicationContext)

为啥这么说呢?我们来看AppplicationContext接口:

public interface ApplicationContext extends EnvironmentCapable, ListableBeanFactory, HierarchicalBeanFactory,
  MessageSource, ApplicationEventPublisher, ResourcePatternResolver {
  }
  1. ApplicationEventPublisher跟Event publication相关
  2. MessageSource跟Message resource handling相关

In short, the BeanFactory provides the configuration framework and basic functionality, and the ApplicationContext adds more enterprise-specific functionality. The ApplicationContext is a complete superset of the BeanFactory and is used exclusively in this chapter in descriptions of Spring’s IoC container.

大致意思如下:

简单的说,BeanFactory提供配置框架和基础的函数,子接口ApplicationContext加入了针对商业特定的方法。

ApplicationContext是BeanFactory完整的超集,在这个Spring IoC容器章节描述中会专门使用。

In Spring, the objects that form the backbone of your application and that are managed by the Spring IoC container are called beans. A bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container. Otherwise, a bean is simply one of many objects in your application. Beans, and the dependencies among them, are reflected in the configuration metadata used by a container.

在Spring世界里,构成应用程序主干和被IoC容器管理的对象称之为beans。一个bean要么实例化,组装,要么被容器管理。除此以外,一个bean就是你应用里许多对象中的一个。

Beans和他们的依赖是在容器使用的配置元数据里反射的。

参考资料:

  1. Introduction to the Spring IoC Container and Beans

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

别怕,Excel VBA其实很简单

别怕,Excel VBA其实很简单

Excel之家 (Excel Home) / 人民邮电出版社 / 2012-10-1 / 49.00元

《别怕,excel vba其实很简单》考虑到大多数读者没有编程基础的实际情况,用浅显易懂的语言和生动形象的比喻,并配合大量插画,介绍excel中看似复杂的概念和代码、从简单的宏录制、vba编程环境和基础语法的介绍,到常用对象的操作与控制、excel事件的调用与控制、用户界面设计、代码调试与优化、都进行了形象的介绍。 《别怕,excel vba其实很简单》适合想提高工作效率的办公人员,特别是经......一起来看看 《别怕,Excel VBA其实很简单》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具