When I move from JDK 8 to JDK 11, I get an illegal access warning, here is the trace:

WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/home/bjorntj/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.2.7.RELEASE/56e14a3a5e2813534b5db2da1502cd58ab5bc61d/spring-core-5.2.7.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
    at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:533)
    at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:363)
    at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110)
    at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108)
    at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
    at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
    at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134)
    at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319)
    at org.springframework.cglib.reflect.FastClass$Generator.create(FastClass.java:65)
    at org.springframework.cglib.proxy.MethodProxy.helper(MethodProxy.java:135)
    at org.springframework.cglib.proxy.MethodProxy.init(MethodProxy.java:76)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:242)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanFactoryAwareMethodInterceptor.intercept(ConfigurationClassEnhancer.java:249)
    at no.havleik.recipes.configuration.SecurityConfig$$EnhancerBySpringCGLIB$$fb4038f1.setBeanFactory(<generated>)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor.postProcessProperties(ConfigurationClassPostProcessor.java:448)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:408)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)

The SecurityConfig class looks like this:

@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends GlobalMethodSecurityConfiguration {

    @Override
    @Bean
    public AuthenticationManager authenticationManager() throws Exception {
        return super.authenticationManager();
    }
}

Is this a known problem? Or perhaps I am using this wrong?

Btw, I am using Spring Boot 2.3.1.

Comment From: JenniferJohnson89

I noticed that there is a similar problem at https://github.com/spring-projects/spring-framework/issues/22674 and https://github.com/spring-projects/spring-framework/issues/24548. Perhaps we can refer to them to find more context about the warning. For example, https://github.com/spring-projects/spring-framework/issues/22674#issuecomment-589116539 and https://github.com/spring-projects/spring-framework/issues/24548#issuecomment-587417930 specify the possible causes; meanwhile, https://github.com/spring-projects/spring-framework/issues/22674#issuecomment-589146533, https://github.com/spring-projects/spring-framework/issues/22814#issuecomment-557456953 and https://github.com/spring-projects/spring-framework/issues/22674#issuecomment-614782054 provide possible workarounds.

You can also refer to https://github.com/spring-projects/spring-framework/issues/24317#issuecomment-612361913 for a quick review.

Comment From: sbrannen

Closing in light of the comments from @JenniferJohnson89

Comment From: bjorntj

Would not really say that this comment makes it solved but.....

Comment From: iGhoneim

It's causing transactions to rollback!