Both beans and aspect are commented by way of
<?XML version= "1.0" encoding= "UTF-8"?> <Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:context= "Http://www.springframework.org/schema/context"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"XMLNS:AOP= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"Xmlns:tx= "Http://www.springframework.org/schema/tx"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-4.1.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP Http://www.springframework.org/schema/aop/sprin G-aop-4.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1. XSD Http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.x SD "> <!--annotation mode Scan Bean -<Context:annotation-config/> <!--scan for packages that start with the manager - <Context:component-scanBase-package= "Manager"/> <!--enable spring-based annotation support for @aspectj aspects - <Aop:aspectj-autoproxy></Aop:aspectj-autoproxy> </Beans>
The bean is configured via XML, aspect through annotations
<?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:tx= "Http://www.springframework.org/schema/tx"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-4.1.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP Http://www.springframework.org/schema/aop/sprin G-aop-4.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1. XSD Http://www.springframework.org/schema/context "> <!--enable spring-based annotation support for @aspectj aspects - <Aop:aspectj-autoproxy></Aop:aspectj-autoproxy> <BeanID= "XXX"class= "XXX"></Bean> </Beans>
Bean through annotations, aspect through XML configuration
<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"Xmlns:context= "Http://www.springframework.org/schema/context"XMLNS:AOP= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-4.1.xsd Http://www.springframework.org/schema/context http://www.springframework.org/schema/c Ontext/spring-context-4.1.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP Http://www.springframework.org/sch Ema/aop/spring-aop-4.1.xsd "> <!--bean creation via annotation - <Context:annotation-config/> <!--scan for packages that start with the manager - <Context:component-scanBase-package= "Manager"/> <!--configuring AOP through XML - <Aop:config> <!--declare where I want to join the plane - <Aop:pointcutexpression= "Execution (* find* (..))"ID= "Testpointcut"/> <!--Declare a slice - <Aop:aspectID= "Aspectjadvice"ref= "Aspectjadvice"> <Aop:beforeMethod= "Dobefore"Pointcut-ref= "Testpointcut"/> <Aop:afterMethod= "Doafter"Pointcut-ref= "Testpointcut"/> <Aop:aroundMethod= "Doaround"Pointcut-ref= "Testpointcut"/><!--must have a return attribute -- <aop:after-returningMethod= "Doreturn"returning= "RetVal"Pointcut-ref= "Testpointcut"/> <!--must have throwing properties--> <aop:after-throwingthrowing= "Ex"Method= "Dothrowing"Pointcut-ref= "Testpointcut"/> </Aop:aspect> </Aop:config> </Beans>
Applicationcontext.xml (Spring)