gpt4 book ai didi

spring - Maven、Scala、Spring、AspectJ

转载 作者:行者123 更新时间:2023-12-04 20:21:26 26 4
gpt4 key购买 nike

有谁知道您是否可以在编译时使用 aspectJ 和 spring 编织 Scala 类。我有编译时编织为我所有的 Java 类工作,但我似乎无法让它为我使用 @Configurable 的 Scala 类工作。

最佳答案

作为背景,我已经为此工作了几天。多么痛苦。无论如何,这就是答案。是的,可以做到,只是不能使用 aspectj maven 插件。您必须使用 antrun maven 插件。 Scala 编码快乐!

        <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"
classpathref="maven.plugin.classpath" />
<iajc
srcDir="src/main/scala"
destDir="target/classes"
inpath="target/classes"
source="1.6"
aspectPath="${org.springframework:spring-aspects:jar}"
classpathRef="maven.compile.classpath"
Xlint="ignore" />
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>

关于spring - Maven、Scala、Spring、AspectJ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6102518/

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