I am experimenting with Spring Boot 2 and AspectJ Load Time Weaving. I am able to run both tests and application from Eclipse (add two agents: aspectjweaver and spring-instrument to the VM), surefire from Maven also runs fine, however I am unable to add two agents to spring-boot-maven-plugin.
Here is my pom.xml snippet
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-javaagent:"${settings.localRepository}/org/springframework/spring-instrument/${spring.version}/spring-instrument-${spring.version}.jar"
-Dspring.profiles.active=test</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<agent>
${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</agent>
<agent>
${settings.localRepository}/org/springframework/spring-instrument/${spring.version}/spring-instrument-${spring.version}.jar
</agent>
</configuration>
</plugin>
Looks like spring-boot-maven-plugin only attaches spring-instrument to the VM. (Actually, always the last 'agent' entry of the pom.
Anyone got an idea, how to get this to work?
I am using Java 8, Spring Boot 2.1.0.RELEASE (AspectJ 1.9.2 and Spring 5.1.2.RELEASE).