gpt4 book ai didi

java - 编译时编织配置

转载 作者:行者123 更新时间:2023-11-30 07:36:13 26 4
gpt4 key购买 nike

我正在尝试将加载时编织的 aspectj 转换为编译时编织。

所以我删除了<context:load-time-weaver/>从我的 spring 配置中,并向我的 pom.xml 添加了一个 aspectj 编译器.但是我不知道如何转换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>

最佳答案

在编译时编织中没有与 aop.xml 完全相同的东西,但您可以配置 AspectJ maven plugininclude and exclude certain aspects像这样

<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>

关于java - 编译时编织配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3767370/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com