Vernacular spring AOP

                                                                     ------------------------------------ rest of the time is running out, caught by doing what you want it

AOP: jargon is called the aspect-oriented programming

Why use AOP : to simplify the code, the code will be the same slicing process, then a so-called re-section, these features will join in

This will be pulled out of the feature called advice (enhancement) (somewhere doing something) , the question is: should I put this advice which places like it?

A: around method of the class, or throw an exception in point, you can have these advice in these areas

The above advice available storage place, called " lead point" .

Now I will advice insert to a certain "point of introduction," then the "point of introduction" is called the "insertion point"

So between the "point of introduction" and "insertion point" is the name for the same thing in different periods, in the absence of the introduction of this advice is called "the point of introduction"

The introduction of "advice" when this is called the "insertion point";

It is now determined above, in one specific place "insertion point", at what time do something (advice), this was defined as the professionals' section. "

Vernacular description "section" : I now hand enhancer, I give you before you go to bed, this section is called, is where you are, what time, what to do. ,

 

So now the basis of how I use this section, but also does not change the original class on the whole does not know will give you quietly been strengthened deal?

A: I went to a pretender , disguised as your original look, then let the JVM can not be found , I first have to replace you, and

     How to achieve java inside it? You can use polymorphism to achieve the original layer of the interface, which is equivalent to the class to find a brother brother , which in this world of programming interfaces

     Brothers foundation can unknowingly replaced, and the "pretender" successfully replaced, strengthening the original method, still do not know the original method

    The vernacular is above JDK dynamic proxy , restrictions of class is to be strengthened, there must be a top interface

 

If the class is no upper interface how to do this itself is a loner how to do? 

A: I went to a "pretender", but this disguise the identity of this person is not "brothers" but "son" , is the inheritance of this class ,

      Then quietly to strengthen him.

 This is above CGLIB dynamic proxy

 

It can be found through the above: AOP implementation is based on dynamic proxy implementation

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/helloqiufei/p/11993142.html