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