aspectj - Spring @Configurable with Maven -
i'm using spring in current project, @configurable annotation doesn't work.
i've used annotation in of classes (most of them jpa entities):
@configurable @entity public class person{ ... @inject private personservice service; ... }
i've put aspectj-maven plugin in pom.xml:
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>aspectj-maven-plugin</artifactid> <version>1.4</version> <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> <executions> <execution> <phase>process-sources</phase> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> <configuration> <outxml>true</outxml> <showweaveinfo>true</showweaveinfo> <xlint>ignore</xlint> <aspectlibraries> <aspectlibrary> <groupid>org.springframework</groupid> <artifactid>spring-aspects</artifactid> </aspectlibrary> </aspectlibraries> <source>${java.version}</source> <target>${java.version}</target> <weavewithaspectsinmainsourcefolder>false</weavewithaspectsinmainsourcefolder> </configuration> </plugin>
but spring aspect not loaded @ compilation time, @inject annotation doesn't work.
the problem maven compilation version.
with version 2.5.1 spring aspect loaded successfully:
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>2.5.1</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>${project.build.sourceencoding}</encoding> </configuration> </plugin>
but version 3.1, aspect not work.
this not work:
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.1</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>${project.build.sourceencoding}</encoding> </configuration> </plugin>
Comments
Post a Comment