How does spring annotation @aspect for spring source analysis work?

Source: Internet
Author: User
Tags cdata

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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.