1. @Aspect
In XML definition: <aop:aspectj-autoproxy/>, which is defined in http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
-<xsd:elementname= "Aspectj-autoproxy">- <xsd:annotation>- <xsd:documentationSource= "Java:org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator">- <! [Cdata[Enables the use of the @AspectJ style of Spring AOP. ]]> </xsd:documentation> </xsd:annotation>- <Xsd:complextype>- <xsd:sequence>- <xsd:elementname= "include"type= "Includetype"minOccurs= "0"maxOccurs= "unbounded">- <xsd:annotation>- <xsd:documentation>- <! [Cdata[indicates that is @AspectJ beans with names matched by the (regex) pattern would be considered as defining a Spects to use for Spring autoproxying. ]]> </xsd:documentation> </xsd:annotation> </xsd:element> </xsd:sequence>- <Xsd:attributename= "Proxy-target-class"type= "Xsd:boolean"default= "false">- <xsd:annotation>- <xsd:documentation>- <! [Cdata[is class-based (CGLIB) proxies to be created? By default, the standard Java interface-based proxies is created. ]]> </xsd:documentation> </xsd:annotation> </Xsd:attribute>- <Xsd:attributename= "Expose-proxy"type= "Xsd:boolean"default= "false">- <xsd:annotation>- <xsd:documentation>- <! [Cdata[indicate that the proxy should is exposed by the AOP framework as a ThreadLocal for retrieval via the Aopconte XT class. Off by default, i.e No. guarantees that Aopcontext access would work. ]]> </xsd:documentation> </xsd:annotation> </Xsd:attribute> </Xsd:complextype> </xsd:element>
1.1 Registration
Org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator
The following are the inheritance relationships:
1.2 Concrete Implementation class is: Abstractautoproxycreator's Postprocessafterinitialization () method
Defaultaopproxyfactory#createaopproxy () method
@Override PublicAopproxy createaopproxy (advisedsupport config)throwsaopconfigexception {if(Config.isoptimize () | | config.isproxytargetclass () | |hasnousersuppliedproxyinterfaces (config)) {Class<?> Targetclass =Config.gettargetclass (); if(Targetclass = =NULL) { Throw NewAopconfigexception ("Targetsource cannot determine target class:" + "either an interface or a targe T is required for proxy creation. "); } if(Targetclass.isinterface ()) {return new jdkdynamicaopproxy (config); } return new objenesiscglibaopproxy (config); } Else { return Newjdkdynamicaopproxy (config); } }
The default use of the JDK comes with a proxy, there is a cglib way.
How does spring annotation @aspect for spring source analysis work?