pih*_*agy 2 java aop spring maven-2 aspectj
我正在尝试将我的加载时编织 aspectj 转换为编译时编织。
所以我<context:load-time-weaver/>从我的 spring 配置中删除,并在我的pom.xml. 但我不知道如何将信息转换为META-INF/aop.xml.
我在那里有这样的东西:
<!DOCTYPE aspectj PUBLIC
"-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
<weaver>
<!-- only weave classes in this package -->
</weaver>
<aspects>
<!-- use only this aspect for weaving -->
<concrete-aspect name="MyAspect_" extends="hu.myAspect">
<pointcut name="pointcut" expression="execution(public * javax.persistence.EntityManager.*(..)) || execution(public * hu..*.create(..))"/>
</concrete-aspect>
</aspects>
</aspectj>
Run Code Online (Sandbox Code Playgroud)
在编译时编织中没有与 aop.xml 完全等效的内容,但是您可以配置AspectJ maven 插件以包含和排除某些方面,例如
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<includes>
<include>**/TransationAspect.java</include>
<include>**/SecurityAspect.aj</include>
</includes>
<excludes>
<exclude>**/logging/*.aj</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4308 次 |
| 最近记录: |