Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GenericConversionService.addConverter should be able to determine generic types from target class behind proxy [SPR-14822] #19388

Closed
spring-projects-issues opened this issue Oct 19, 2016 · 1 comment

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Oct 19, 2016

Harald Radi opened SPR-14822 and commented

WebMvcConfigurationSupport.mvcConversionService() creates a non-overrideable DefaultFormattingConversionService which scans for all Converter-beans. If one of those beans happens to be advised an IllegalArgumentException is thrown, since GenericConversionService.getRequiredTypeInfo() tries to derive the type info from the Proxy that only contains the type erasures and not the actual types.
Adding a proxy check and deriving the type info from the proxy-target would resolve that issue.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcConversionService' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to the determine sourceType <S> and targetType <T> which your Converter<S, T> converts between; declare these generic types.

Affects: 4.3.3

Issue Links:

  • #18457 AnnotationAwareOrderComparator getPriority does not work if bean is a proxy
  • #19496 ConversionService performance regression

Referenced from: commits f9fcd24, f7d740f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants