WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/home/stephane/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.3.2/152489ed8223a6ad19065a3cd1ee6b9e20c0b82f/spring-core-5.3.2.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
note: I also upgraded to gradle 6.8 I get this warning on server launch after having updated spring dependencies.
Comment From: LifeIsStrange
The warning disappear if I comment // developmentOnly("org.springframework.boot:spring-boot-devtools")
why ?
Comment From: LifeIsStrange
The doc https://docs.spring.io/spring-boot/docs/1.5.16.RELEASE/reference/html/using-boot-devtools.html#using-boot-devtools says using compileOnly is best practice but I believe (?) it is obscolete and should be developmentOnly() ? Anyway, both trigger the warning. Can this trigger bugs ? This should be fixed as it must affect a huge number of projects
Comment From: wilkinsona
You've described the problem as a regression and that it is occurring after upgrading some Spring dependencies. What version were you using before and what version have you upgraded to?
The doc says using compileOnly is best practice but I believe (?) it is obscolete and should be developmentOnly() ?
That documentation is for Spring Boot 1.5.16 which predates the developmentOnly
configuration. More recent documentation recommends the use of developmentOnly
.
The warning disappear if I comment
// developmentOnly("org.springframework.boot:spring-boot-devtools")
why ?
Using Devtools changes the class loaders that are involved. I can't say exactly why it is triggering the warning, but that is a likely cause. To be more precise, we'll need some more information about the problem. To that end, can you please provide a minimal sample that reproduces it? You can share it with us by zipping it up and attaching it to this issue or by pushing it to a separate repository on GitHub.
Comment From: LifeIsStrange
Many thanks for the quick and correct answer, unfortunately I can't work on that until a few days, I'll ping you when I'll submit a reproducer.
Comment From: snicoll
@jhoeller has added a new method in Spring Framework 5.3.4 (see https://github.com/spring-projects/spring-framework/issues/26403) so we'll have to wait for that to be able to benefit from the fix.
I was able to easily reproduce the warning with instructions from Juergen but, unfortunately, I didn't manage to assert on the presence or absence of the warning as it seems to be logged outside of the test boundary. I've created a branch that switches to the snapshot (see #24884) and apply the fix. With that in place the warning is gone.
For those interested the branch is: https://github.com/snicoll/spring-boot/tree/gh-24857