Spring IoC container

IoC is also known as dependency injection (DI). It is a process whereby objects define their dependencies, that is, the other objects they work with, only through constructor arguments, arguments to a factory method, or properties that are set on the object instance after it is constructed or returned from a factory method.

IoC也叫依赖注入。   它是一个通过对象,定义依赖的程序(那些他一起工作的对象)。只有通过构造器参数,工厂方法的参数,或者是已经创建或者由工厂方法返回的堆对象上设置的属性。

The org.springframework.beans and org.springframework.context packages are the basis for Spring Framework’s IoC container.

org.springframework.beans和org.springframework.context是Spring框架IoC的基础包。

The BeanFactory interface provides an advanced configuration mechanism capable of managing any type of object.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.

BeanFactory接口

The idea that a bean definition is a recipe is important, because it means that, as with a class, you can create many object instances from a single recipe.

The scope of the Spring singleton is best described as per container and per bean. This means that if you define one bean for a particular class in a single Spring container, then the Spring container creates one and only one instance of the class defined by that bean definition. The singleton scope is the default scope in Spring

posted @ 2017-11-29 18:00  爱水果  阅读(107)  评论(0编辑  收藏  举报