1. 程式人生 > >Spring-IoC之 IoC 容器介紹

Spring-IoC之 IoC 容器介紹

參考文獻:Spring官網

IoC容器的作用:1,例項化bean;2,組裝bean,3,裝配bean

實現的三種方式:1,XML檔案配置,2,註解配置(spring2.5以上),3,Java程式碼配置(spring3.0以上),下一篇檔案具體介紹。

官方解釋:responsible for instantiating, configuring, and assembling the aforementioned beans

一,BeanFactory介面

官方解釋:BeanFactory provides the configuration framework and basic functionality

解析:BeanFactory提供了Spring-IoC容器的基本功能和配置架構。

二,ApplicationContext介面

 is a sub-interface of BeanFactory. It adds easier integration with Spring’s AOP features; message resource handling (for use in internationalization), event publication; and application-layer specific contexts such as the WebApplicationContext

 for use in web applications.

解析:ApplicationContext在BeanFactory基礎上,增加了很多功能,其中包括:1,Spring AOP 特性的整合;2,國際化的支援,,事件釋出;3,應用層的上線文,例如:web應用中的WebApplicationContext。

三,Application Context介面的幾個實現類:

1)獨立應用的容器:ClassPathXmlApplicationContext,FileSystemXmlApplicationContext

2)。。。