I'm attempting to migrate from spring-modulith 2.0.1 to 2.1.0 and am seeing the following error when re-running tests (omitting some lines for brevity):
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource [org/springframework/boot/webmvc/autoconfigure/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Cannot invoke "java.lang.Class.getTypeName()" because "type" is null
Related cause: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'viewResolver': Requested bean is currently in creation: Is there an unresolvable circular reference or an asynchronous initialization dependency?
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1815)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:603)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:525)
... 80 common frames omitted
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Class.getTypeName()" because "type" is null
at org.springframework.modulith.core.FormattableType.of(FormattableType.java:108)
at org.springframework.modulith.observability.support.DefaultObservedModule.render(DefaultObservedModule.java:129)
The cause appears to be my custom AbstractHttpMessageConverter :
public class IntegerHttpMessageConverter extends AbstractHttpMessageConverter<Integer> {
Since it's registered as a Spring Bean, it gets wrapped in a CGLIG proxy via ModuleEntryInterceptor. When RequestMappingHandlerAdapter calls canWrite(...) on it during SSE converter setup, the interceptor tries to render the span name, hits the Class<?> wildcard, and NPEs — which then cascades into the viewResolver/requestMappingHandlerAdapter circular-bean-creation failure.
This appears related to #1713, but that only covered primitives rather than unbounded wildcard generics.
I'm attempting to migrate from
spring-modulith2.0.1 to 2.1.0 and am seeing the following error when re-running tests (omitting some lines for brevity):The cause appears to be my custom
AbstractHttpMessageConverter:Since it's registered as a Spring Bean, it gets wrapped in a CGLIG proxy via
ModuleEntryInterceptor. WhenRequestMappingHandlerAdaptercallscanWrite(...)on it during SSE converter setup, the interceptor tries to render the span name, hits theClass<?>wildcard, and NPEs — which then cascades into the viewResolver/requestMappingHandlerAdapter circular-bean-creation failure.This appears related to #1713, but that only covered primitives rather than unbounded wildcard generics.