spring analytic architecture - Getting Started

Spring Framework core components are only three: Core, Context and Beans. They built up a whole Spring of bone architecture.
Simple to understand: spring core is a tool, context is the environment, and the bean is the protagonist.

Core
the Spring Core is found to be responsible for creating and processing a toolkit relationship between the bean. It can be understood, core to another method of injecting the bean creation, the bean defined, top service just call enough. But do not provide the function call is the raison d'etre of the spring core. The upper layer of the service will call the bottom of the core to achieve their respective functions.

context
context to call someone else's function;
we know Bean package is Object, and Object must have data, how to provide a living environment Context is the problem to be solved for these data, Context for him is to discover the relationship between each Bean establish this relationship and for them to maintain a good relationship. So Context is a collection Bean relations, this relationship collection called Ioc container, once established this Spring Ioc container that you can work.

Context as Spring's Ioc container, basically integrates most of the functionality of the Spring, or that is the basis for most of the functions, so it calls the most of the spring core.

We generally use the application context is a web application, to start a web server controlled by the container; but we need to pay attention when using manual java application to get the bean:

Bean
already explained the importance of the components of the Spring Bean, Bean take a look at how this modular design. Spring assembly at the Bean org.springframework.beans package. All classes in this package is mainly to solve three things: the definition of Bean, Bean's creation and parsing of the Bean. Spring is the only user of the need to care about is the creation of Bean, the other two completed by the Spring inside to help you, is transparent to you.
When you create a Spring Bean factory pattern typical of his top-level interface is BeanFactory.

Other
1. If you use a BeanFactory factory BeanFactory ,, to load the Spring configuration file, so that when you call getBean, the default constructor call the object's frame to create the object. BeanFactory function is to bean object lifecycle management. (Creation, initialization, destruction).

2.ApplicationContext (recommended framework is the default) object to load the Spring configuration file, parses the configuration file at load time, creating an object, rather than in the getBean time. In fact, ApplicationContext interface extends BeanFactory, it has all the features BeanFactory, while adding extended functionality, such as loading the resource profile, international support!

Guess you like

Origin www.cnblogs.com/Carrol/p/11351272.html