Home » Java » sprin


The meaning of

dependency injection is an old growth issue. I don't understand much about this. I hope we can discuss.

My understanding

1. objects must be associated with each other so that the whole system
can be formed
Coupling between 2. objects can be coupled between classes, which makes it difficult for the program to maintain and modify

3. has found interface oriented development, which can easily replace one class with another, only coupled with the interface (which is already perfect),

4. interface coupling, we must also manually create the implementation class in the class, or the client class must know the specific implementation.

5., using factory mode prevents the client class from having too much specific implementation knowledge. This is enough code to be coupled with the factory class and has to create a large number of factory classes
by itself
6.spring provides a range of factory collections that are only coupled with spring,

7.spring uses some technology, automatic loading, annotations, and other methods to implement code and spring low coupling

Spring source code analysis method

springIOC is a very complex, has not been found before learning method (see picture layer), the effect is not ideal, until recently found a good way to share, is learning, follow-up will add

tools: IDEA

UML: casually finds one (http://www.cnblogs.com/yjmyzz/p/4588386.html) and everybody looks at

Train of thought:

1. first find something about the spring framework, and have a broad understanding of the main interfaces and frameworks.

2. read the main interfaces (both in English) and the author's notes are very clear.

3. use IDEA to create a.Uml diagram, add the various interfaces you see, and draw the class diagram

4., do not understand, direct F4 into the interface to see, do not understand, you can use his implementation class assisted learning. ()

IOC critical interface
BeanFactory (bean factory)

defines the basic parent interface of IOC and provides the getBean () method bean for obtaining

FactoryBean (factory bean)

defines the getObject () method for creating bean,

HierarchicalBeanFactory (hierarchical BeanFactory)
The child interface of

BeanFactory extends BeanFactory, defining BeanFactory to have parent factory

AutowireCapableBeanFactory (configurable BeanFactory)

extends BeanFactory to automatically load and attribute assignments to bean,

Provides functionality to integrate with other frameworks to configure the bean configuration property spring that already exists but is not managed by

ListableBeanFactory (list of BeanFactory)

extends BeanFactory to get collection properties and provides containsBeanDefinition () getBeanNamesForType ()

BeanDefinition (Bean definition)

spring Abstract Bean definition, described in detail the various attributes of bean

Single instance or prototype className constructor.

Spring creates an instance of BeanDefinition through

following article, I will explain from each interface I understand spring, welcome everyone Tucao

Reference material