Open pdeneve opened 1 year ago
@pdeneve I don't think the instruction to reproduce are correct. Shouldn't we do something before exec:exec
?
@snicoll Thanks for having a look. You're right, you need to run mvn compile
before. I've updated the instructions. Please note I've just updated all dependencies, so please pull. The updated instructions apply to the new version.
Created this issue as suggested here.
To enable AspectJ load time weaving in a Spring application, one would use the
@EnableLoadTimeWeaving
annotation as outlined in the Spring reference documention. Due to issue 29609 this is not working and a workaround proposed involves registeringAspectJWeavingEnabler
andDefaultContextLoadTimeWeaver
upfront when instantiating the application context. For a spring boot application, this looks as follows:With
MyLoadTimeWeaver
extendingDefaultContextLoadTimeWeaver
and annotated with@Component("loadTimeWeaver")
because the name of theLoadTimeWeaver
bean "loadTimeWeaver
" is expected by the framework.When running the application, some auto-configured beans cannot be accessed anymore. E.g. for the
spring.boot.ltw
module in this repository, the following stacktrace is produced:To reproduce yourself:
spring_boot_issue
mvn compile -pl spring.boot.ltw
JAVA_HOME
points to a Java 21 JDKmvn dependency:properties exec:exec -pl spring.boot.ltw
It is possible to workaround this issue by defining manually the beans for which an
IllegalAccessError
occurs. E.g. for the sample project, uncomment the@Bean
annotation for theJdbcConnectionDetails
bean inConfig.java
and it will work.