Third, Aspect Oriented Programming

Session Eight Oriented Programming --aop

1, aop: aspect oriented programming Aspect Oriented Programming

2, aop role in the spring

  Provide declarative transaction services (declarative transaction)

  It allows users to implement custom aspects

3, aop: add new features without changing the original code.

  Traditional programming modes:

Aop programming model: Programming transverse

Aop advantage of the benefits is the agent :( aop benefits)

  a) makes the real role of business process more pure, and not to focus on some common things.

  b) public business done by the agency to achieve business division ---

  c) become more concentrated and convenient public business expansion occurs

4 Glossary

      Focus: an increase in business. Such as logging, security, caching, transactions, exception handling. (Example: an increase in the methods of the proxy class code in front of the log (); method, this method is a concern, we have a better method for this process, the following ~~)

   Section (Aspect): a modular point of concern. (The above log () be a log concern, but this concern, we can use this method of packaging to a single class, cut surface is formed, because this method may be used both before and after methods)

   Connection points: that the implementation of the connection point, the connection point cut cut of a method (such as: add (); delete (); update (); select () method is the point of attachment)

   Notice: the action performed on a particular join point is to inform (in fact, this is tracked, such as log (); is before the target method execution call it focus, spring it sorted out notification front, rear notification, abnormality notification, surrounded notification, the notification may be considered to be a specific connection point) (also a process, an action)

  Audience: The proxy object is called the target object (as previously wrote extended to Object target in the general case)

  Weaving: the aspects with other application types or objects, and create an object to be notified (several types, above) (actually a process).

  In summary, only three modular concept 1. concerns ------ ---> 2. Aspect 3. junction

  To sum up then, and only cut the connection point of the two concepts.

 

5, using spring aop achieve

   The first implementation - implemented by springAPI

 

Guess you like

Origin www.cnblogs.com/djlindex/p/11365877.html