Spring core concept study notes

1 , the Spring mainly used two design patterns

1.1 Factory Pattern

Spring container is instantiated and manage all Bean factory.

Factory mode may be Java caller object is separated from the logic implemented in the callee.

The caller only care about certain rules that must be met by the caller, the rule here is that we can be seen as an interface, without having to be concerned about instances of a specific implementation process, concrete realization of the Bean to complete the plant.

1.2 singleton

   Spring default all Bean set to a singleton, that is all the same Bean request, it will return to the same shared Bean instance, so that you can greatly reduce the Java system overhead of object creation and destruction.

Use Spring to Bean set to singleton mode, you do not need to complete their singleton.

 

2, the Spring core mechanism

2.1 Inversion of Control and the Dependency Injection

 Spring , create callee's work is no longer done by the caller, it is called inversion of control.

 Examples of the caller is created by the work Spring to complete the container, and then injected into the caller, it is called dependency injection.

 

(Dependent meanings: a defined change occurred two elements will cause a change in another element, called a dependency exists between the two elements)

 

3, the Spring core mechanism

3.1 Aspect-Oriented Programming

  Aspect-oriented programming is AOP .

  He did not replace object-oriented programming OOP , he complements object-oriented programming.

AOP from a dynamic point of view of program structure, so that the OOP more perfect.

Object-oriented programming a program down into levels of object-oriented programming and the operation of each section of the program is decomposed.

 

Guess you like

Origin www.cnblogs.com/schangxiang/p/11144957.html