ClassCastException after upgrading to Spring6

60 views Asked by At

I m getting the following exception after migrating to Spring 6:

java.lang.ClassCastException: class com.example.application.profile.publicapi.oidcprovider.WebConfig$$SpringCGLIB$$0 cannot be cast to class org.springframework.cglib.proxy.Factory (com.example.application.profile.publicapi.oidcprovider.WebConfig$$SpringCGLIB$$0 and org.springframework.cglib.proxy.Factory are in unnamed module of loader 'app')
    at org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:91)
    at org.springframework.aop.framework.CglibAopProxy.buildProxy(CglibAopProxy.java:218)
    ... 47 common frames omitted

The WebConfig class:

@EnableWebMvc
class WebConfig : WebMvcConfigurer {
  override fun extendMessageConverters(converters: MutableList<HttpMessageConverter<*>>) {
    converters.add(MappingJackson2HttpMessageConverter())
    super.extendMessageConverters(converters)
  }
}

Anyone knows what is wrong? It is a hell to debug Spring unless you are one of the authors of the framework.

Thanks for any help!

0

There are 0 answers