Has anyone been able to use AspectJ w/ Spring Boot...
# spring
e
Has anyone been able to use AspectJ w/ Spring Boot and Kotlin? I’m trying to instrument a third party library, but for some reason it isn’t picking up my settings in
META-INF/aop.xml
. Also, when instrumenting Kotlin classes, it throws
org.aspectj.weaver.loadtime.Aj - com/company/<NameOfKotlinClass>MethodAccess java.lang.RuntimeException: Illegal type for StackMapType: 12
.
Oh… the spring boot assembly puts files in
META-INF
in to
BOOT-INF/classes/META-INF
So it seems that I’ll need to package that differently for the agent to find it.
That doesn’t seem right because the
BootJar
task specifically leaves
aop.xml
in the
BOOT-INF
directory:
Copy code
void moveMetaInfToRoot(CopySpec spec) {
   spec.eachFile((file) -> {
      String path = file.getRelativeSourcePath().getPathString();
      if (path.startsWith("META-INF/") && !path.equals("META-INF/aop.xml") && !path.endsWith(".kotlin_module")) {
         moveToRoot(file);
      }
   });
}