Configuring spring's AOP based on XML file format

Source: Internet
Author: User

Use examples to directly illustrate:

<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"XMLNS:AOP= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"Xmlns:context= "Http://www.springframework.org/schema/context"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/spring-aop-4.0.xsd/HTTP Www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd " ><BeanID= "Arithmeticcalculator"class= "Com.jeremy.aop.xml.ArithmeticCalculatorImpl"></Bean><!--The first step is to configure the bean, because the slice is also a bean -<BeanID= "Loggingaspect"class= "Com.jeremy.aop.xml.LoggingAspect"></Bean><!--The second configuration of AOP -<Aop:config>        <!--The third step configures the expression used by the slice -        <Aop:pointcutexpression= "Execution (* com.jeremy.aop.xml.arithmeticcalculator.* (..))"ID= "Pointcut"/>        <!--Fourth Step configuring facets, specifying slice classes -        <Aop:aspectref= "Loggingaspect">            <!--Fifth Step configuration notification -            <Aop:beforeMethod= "Beforemethod"Pointcut-ref= "Pointcut"/>            <Aop:afterMethod= "Aftermethod"Pointcut-ref= "Pointcut"/>            <!--Returning: Represents the value returned, remember to tell the method which parameter is consistent, in fact, as the annotation, the essence of the annotation is based on the XML configuration -            <aop:after-returningMethod= "Afterreturning"Pointcut-ref= "Pointcut"returning= "Result"/>            <!--e: Represents the exception to be passed -            <aop:after-throwingMethod= "Afterthrowing"Pointcut-ref= "Pointcut"throwing= "E"/>                    </Aop:aspect></Aop:config><BeanID= "Validateaspect"class= "Com.jeremy.aop.xml.validateAspect"></Bean></Beans>

Configuring spring's AOP based on XML file format

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.