The tests fail with:

       org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:142)
       org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:127)
       org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:191)
       org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:130)
       org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:241)
       [...]
     Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxController': Unexpected AOP exception
       org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:605)
       org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
       org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
       org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
       org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
       [...]
     Caused by: org.springframework.aop.framework.AopConfigException: Unexpected AOP exception
       org.springframework.aop.framework.CglibAopProxy.buildProxy(CglibAopProxy.java:222)
       org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:158)
       org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
       org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor.postProcessAfterInitialization(AbstractAdvisingBeanPostProcessor.java:127)
       org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:434)
       [...]
     Caused by: java.lang.UnsupportedOperationException: CGLIB runtime enhancement not supported on native image. Make sure to include a pre-generated class on the classpath instead: com.xxx.XXXController$$SpringCGLIB$$42
       org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:359)
       org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:575)
       org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.lambda$new$1(AbstractClassGenerator.java:103)
       org.springframework.cglib.core.internal.LoadingCache.lambda$createEntry$1(LoadingCache.java:52)
       java.base@17.0.7/java.util.concurrent.FutureTask.run(FutureTask.java:264)

Comment From: sbrannen

Hi @phejl,

That's unfortunately insufficient information for us to diagnose the issue.

Please provide a minimal sample that reproduces the issue, preferably something that we can download and run (for example, a ZIP file or a public Git repository).

Thanks

Comment From: phejl

@sbrannen Thank you. Yeah sure I'll try. I'm not done with that one yet :) Hopefully I'll get some clue. Proxies seem to be generated.

Comment From: phejl

@sbrannen Hm, afterall the underlying issue is this: https://github.com/spring-projects/spring-framework/issues/30525#issuecomment-1560771511

When org.springframework.boot.test.autoconfigure.web.servlet.SpringBootMockMvcBuilderCustomizer is registered for reflection the tests pass ok.

Comment From: sbrannen

Thanks for the feedback.

In light of that, I am closing this issue.