The advantages of spring ?
1. Reduces the coupling between components and realizes decoupling between software layers
2. Can use many easily provided services, such as transaction management, message services, etc.
3. Container Provide singleton mode support
4. The container provides AOP technology, which can easily implement functions such as permission interception and runtime monitoring
5. The container provides numerous auxiliary classes to speed up application development
6.spring provides integrated support for mainstream application frameworks, such as hibernate, JPA, Struts, etc.
7.spring is a low-intrusion design with extremely low code pollution
8.Independent of various application servers
9.Spring’s DI mechanism reduces the complexity of business object replacement
10.Spring’s high degree of openness does not force applications to rely entirely on Spring. Developers can freely choose part or all of spring
What is the DI mechanism?
Dependency Injection (Dependecy Injection) and Inversion of Control (Inversion of Control) are the same concept. Specifically: when a role
needs the assistance of another role, in the traditional programming process, Typically the caller creates an instance of the callee. But in spring
The work of creating the callee is no longer done by the caller, so it is called inversion of control. The work of creating the callee is done by spring, and then the caller is injected
, so it is also called dependency injection.
spring manages objects in a dynamic and flexible way. There are two ways of injection, setting injection and construction injection.
Advantages of setting injection: intuitive and natural
Advantages of construction injection: the order of dependencies can be decided in the constructor.
What is AOP?
Aspect-oriented programming (AOP) improves spring's dependency injection (DI). Aspect-oriented programming mainly manifests in two aspects in spring
1. Aspect-oriented programming provides declarative transaction management
2.spring support User-defined aspects
Aspect-oriented programming (aop) is a supplement to object-oriented programming (oop).
Object-oriented programming decomposes the program into objects at various levels, and aspect-oriented programming divides the program running process into Decompose into various aspects.
AOP considers the structure of the program from the perspective of program operation and extracts aspects of the business processing process. oop is a static abstraction, aop is a dynamic abstraction,
is to abstract the steps in the application execution process, thereby obtaining the steps logical division between.
The aop framework has two characteristics:
1. Good isolation between each step
2. Source code independence
Are the above the advantages of spring? What is the DI mechanism? What is AOP? For more related content, please pay attention to the PHP Chinese website (www.php.cn)!