1.1 What is Spring
Spring is a layered javase/ee full-stack ( one-stop ) lightweight open-source framework with IOC (inverse of control inversion) and AOP (Aspect oriented Programming is a kernel -oriented programming for slicing.
Hierarchical
* The three-tier architecture of the EE provided by Sun: Web tier, business layer, data access layer (persistence layer, integration layer)
* STRUTS2 is the Web layer based MVC design pattern framework.
* Hibernate is a long-lasting ORM framework.
* One-stop:
* The Spring framework has a three-tier solution for each layer:
* Web tier: Spring MVC.
* Persistence layer: JDBC Template
* Business layer: Spring's bean management.
1.2 Spring's core
The IOC is the abbreviation for inverse of control, which means inversion of controls, The creation of an object (instantiated) is handed over to the spring framework creation process. when an IOC is applied, other objects that an object relies on are passed in passively, rather than the object itself creating or locating dependent objects.
AOP is an abbreviation for aspect oriented programming, meaning aspect-oriented programming precompiled mode and run-time dynamic agent implementation of a unified maintenance of the program functions of a technology. AOP takes the horizontal extraction mechanism, replaces the traditional vertical inheritance system repetition code, uses the SPRINGAOP to complete the function: Performance monitoring, transaction management, logging, caching, etc., is the object-oriented (OO) extension of the function, to solve some object-oriented problems.
The relevant terms for AOP are as follows:
1.Target: Target object, object being proxied. Example: UserService
2.JoinPoint: Connection point, the method (off) of the target object that is being proxied. Example: Saveuser ()/updateuser/deleteuser/finduser
3.PointCut: Pointcut, actually the method of being represented, and the actual connection point. Example: Saveuser
Pointcut is a subset of connection points
4.Advice: Classification: Pre-notification, post-notification, surround notification, etc., the notification is to enhance the method.
5.Introduction: Referral, Special notice. Directly enhances the class. Add methods to classes, modify not methods, and so on.
6.Weaving: Weaving: Refers a notification to a process on the target object. And the process of associating notifications with pointcuts.
7.Proxy: Proxy, target object targets generate proxy object, so it can be enhanced by code.
Advantages of 1.3 spring
1. Easy to decouple and simplify development
* Spring is a large factory that allows all object creation and dependency maintenance to be delivered to spring management
Support for 2.AOP programming
* Spring provides aspect-oriented programming, which can easily implement the functions of permission interception, operation monitoring and so on.
3. Support for declarative transactions
* Management of transactions can be done only through configuration, without manual programming
4. Convenient program Testing
* Spring support for JUNIT4, you can easily test the spring program with annotations
5. Easy integration of various excellent frameworks
* Spring does not exclude a variety of excellent open source frameworks that provide direct support for a variety of excellent frameworks (e.g. Struts, Hibernate, MyBatis, quartz, etc.)
6. Reduce the difficulty of using Java EE API
* Spring provides encapsulation for some of the most difficult APIs (JDBC, JavaMail, remote calls, etc.) in Java EE Development, making these API applications much less difficult to apply
Spring Knowledge points Summary