Joke Collection Website - News headlines - How to understand the AOP of Spring?

How to understand the AOP of Spring?

AOP of Spring is aspect-oriented programming, which is horizontal. For example, when the program is running, it needs to build a log, which is equivalent to the trigger of SQL.

Spring is an open source design framework, which solves the problem of loose coupling between business logic layer and other layers, so it runs the interface-oriented programming idea through the whole system. Spring is a lightweight Java development framework, which appeared in 2003 and was founded by Rod Johnson. Simply put, Spring is a layered JavaSE/EEfull-stack (one-stop shop)? Lightweight open source framework.

Spring characteristics:

1, which facilitates decoupling and simplifies development.

Through the IoC container provided by Spring, we can leave the dependencies between objects to Spring to control and avoid excessive program coupling caused by hard coding. With Spring, users don't have to write code for very low-level requirements such as single-instance schema classes and property file parsing, so they can focus more on upper-level applications.

2.AOP programming support

The AOP function provided by Spring is convenient for aspect-oriented programming, and many functions that are difficult to realize by traditional OOP can be easily handled through AOP.

3. Support declarative transactions

In Spring, we can get rid of the monotonous and boring transaction management code, manage transactions flexibly in a declarative way, and improve the development efficiency and quality.

4. Convenient program testing

Almost all testing work can be done in a container-independent programming way. In spring, testing is no longer an expensive operation, but something that can be done at will. For example, Spring supports Junit4, and it is convenient to test Spring programs through comments.

5. It is convenient to integrate various excellent frameworks.

Spring does not exclude all kinds of excellent open source frameworks. On the contrary, Spring can make it easier to use various frameworks. Spring directly supports various excellent frameworks (such as Struts, Hibernate, Hessian, Quartz).

6. reduce the difficulty of using Java EE API.

Spring provides a compact encapsulation layer for many complex Java ee APIs (such as JDBC, JavaMail, remote call, etc.). ). Through the simple encapsulation of Spring, the difficulty of using these Java ee APIs is greatly reduced.

7.Java source code is a classic learning example.

Spring's source code design is exquisite, and its structure is clear and ingenious, which reflects the master's flexible use of Java design pattern and profound attainments of Java technology everywhere. Spring framework source code is undoubtedly the best practice example of Java technology. If you want to improve your Java technology and application development level quickly in a short time, learning and studying Spring source code will make you get unexpected results.