Constitute the cornerstone of Spring AOP Spring framework

Spring AOP is an important cornerstone of the constitution of the Spring Framework, spring AOP built IOC

Above, and ioc natural, united in the Spring container.

AOP specific applications: suitable for applications with specific logic, such as performance testing, access control, object management, and logging.

AOP (Aspect Oriented Programing) Oriented Programming The idea of reconstruction software, if the same code have multiple classes, these same code to extract parent class, by the AOP extraction mechanism for such lateral longitudinal not inherited by abstract system of repetitive code provides solutions press.

The term & AOP:
1, the connection point (JoinPooint): before the start of the initialization program executed in a particular location, such as a class, the class initialization, before a class method calls / after the method throws an exception. Class or a specific piece of code has the nature of the boundary point, which is the point of attachment. Spring supports only method of connection points, i.e., only before the method call, the method call, the program execution method throws these points before and after the abnormal weaving reinforcing and method call;
2, point of tangency (Pointcut): Each program class have multiple connection points, we want to locate the connection point in the multiple connection points. By positioning the point of attachment relationship AOP tangent point, the tangent point and the connection point is not one to one, a cut point may match a plurality of connection points. .
3, Enhanced (Advice): enhancement is woven into a program code on the connection point of the target class, Spring addition to the reinforcing section is used to describe the program code, but also has other information related to the connection point, the orientation point of execution. Spring-specific interface is with an azimuth name: BeforeAdvice, AfterReturningAdvice, etc.
4, the target object (Target): Enhanced Logic weaving target class
5, introduce (Introduction): introducing a special reinforcement, he add some properties to the class and methods.
6, weaving (Weaving): Add to reinforcing concrete target class linking point of the process.
7, the proxy (Proxy): After a category is woven into the AOP enhanced, it outputs a result class, which is a fusion of the original class and Enhanced Logic proxy class. Depending on the agency, agency class can be both original and classes have the same class interface, and might also be a subclass of the original class, the same way we call the original class can be used to call the proxy class.
8, section (Aspect): cut by the tangent point and the reinforcing composition, he defines both transverse logic, including the definition of the point of attachment.
Overall: AOP is how to focus on the point of attachment is applied to the reinforcing target object, which includes a first, and how the tangent point positioned by enhancing a connection point, the second, how to write code section enhancement.


Guess you like

Origin www.cnblogs.com/shoose17/p/11371577.html