我想在Spring框架中将Spring AOP更改为纯aspectJ。
使用Spring AOP,如下所示。
<aop:config >
<aop:pointcut id="testopiaLogging" expression="execution(public * cosmos..*SVC.*(..))" />
<aop:aspect ref="testopiaLoggingAspect">
<aop:after-throwing method="throwError" throwing="exception" pointcut-ref="testopiaLogging"/>
<aop:after-returning method="log" returning="retVal" pointcut-ref="testopiaLogging"/>
</aop:aspect>
</aop:config>
我将把它改为纯粹的aspectJ,然后将其改为url的页面
spring-aspect.jar在classpath中设置。
所以我制作了aop.xml。
<aspectj>
<weaver>
<include within="cosmos.*" />
</weaver>
<aspects>
<aspect name="com.sds.testopia.logger.aop.TestopiaAspect" />
</aspects>
</aspectj>
我想获得具体和详细的解释。 THX。
答案 0 :(得分:2)
AspectJ不适用于Spring的XML风格的AOP。您需要使用传统的AspectJ(.aj)或基于注释的@AspectJ
(。java)格式。但是你不能使用XML创建AspectJ方面(只有Spring AOP方面)。