Weaving @aspectj Facets by configuration
Although the facets can be woven programmatically, in general, we use spring's configuration to automate the creation of the agent-woven facets.
The <aop:aspectj-autoproxy/> Declaration of the AOP namespace automatically creates an agent for those beans in the spring container that are configured with @aspectj facets, weaving the facets. Of course, spring
In the internal still use Annotationawareaspectjautoproxycreator for automatic proxy creation work, but the details of the implementation has been <aop:aspectj-autoproxy/> hidden up
<aop:aspectj-autoproxy/> has a Proxy-target-class property, which defaults to false, which means that the use of JDK dynamic agent weaving enhancements, when fitted as <aop:aspectj-autoproxy Poxy-target-class= "true"/> Represents the use of Cglib dynamic Agent technology to weave in the enhancement. However, even if the Proxy-target-class is set to False, if the target class does not declare an interface, spring will automatically use the Cglib dynamic proxy.
@AspectJ Grammar Basics
@AspectJ the facets are described using the jdk5.0 annotation and the tangent expression language of the regular AspectJ 5, because spring supports only the connection points of the method, spring supports only partial aspectj of the tangent language, and in this section, We will do the necessary learning for the aspectj tangent-point expression language.
Tangent-point expression functions
The pointcut expression for AspectJ 5 consists of a keyword and an action parameter. such as execution (*greeto (..)) The pointcut expression, "execute" is the keyword, and "*greeto (..)" is the action parameter. Here, execution executes a method on behalf of the target class, and "*greeto (..)" is a matching pattern string that describes the target method, which together represents the tangent point matching the target class Greeto (..) The connection point of the method. For the sake of convenience, we call execution () a function and match the string "*greeto (..)" Referred to as a function's entry parameter.
Role of ">
Role of ">
Role of ">