You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AnnotationDrivenBeanDefinitionParser should allow injection of custom HttpMessageConverter's [SPR-7091] #11751
There should be a way to inject custom http message converters into AnnotationDrivenBeanDefinitionParser. Currently its hardcoded and set to a private method
I've worked around this by referring to the schema-generated bean by its name "org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0" and using the MethodInvokingFactoryBean to call its setMessageConverters method - but this feels like a hack. As a user of the AnnotationMethodHandlerAdapter, I would expect my HttpMessageConverters to be auto-detected by type - in the same way as HandlerMapping and HandlerAdapter instances are auto-detected by the DispatcherServlet. I'd like to see this added in a future release.
I vote for this issue. It would be nice if <mvc:annotation-driven /> can detect already registered message converters. In my case I would like to customize MappingJacksonHttpMessageConverter but I can't do it easily, as this class is created new by AnnotationDrivenBeanDefinitionParser. I propose that (a) it should check the context for unknown implementations of HttpMessageConverter's and (b) it should use already defined already customized beans for "known" HttpMessageConverter's (e.g. FormHttpMessageConverter, ...). Maybe this problem should be solved by AnnotationMethodHandlerAdapter itself, which can collect all HttpMessageConverter's just after context has been instantiated (ApplicationContextAware). Relative to #11850 and #11416, as having autodetection implemented solves them.
Activity
spring-projects-issues commentedon Jul 20, 2010
Peter Feltham commented
I've worked around this by referring to the schema-generated bean by its name "org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0" and using the MethodInvokingFactoryBean to call its setMessageConverters method - but this feels like a hack. As a user of the AnnotationMethodHandlerAdapter, I would expect my HttpMessageConverters to be auto-detected by type - in the same way as HandlerMapping and HandlerAdapter instances are auto-detected by the DispatcherServlet. I'd like to see this added in a future release.
spring-projects-issues commentedon Jul 20, 2010
Simon Wong commented
The following works fine for me. Since <mvc:annotation-driven / > did not cater the MessageConverter for ExceptionResolver, I have set it explicitly
spring-projects-issues commentedon Jul 22, 2010
Dmitry Katsubo commented
I vote for this issue. It would be nice if
<mvc:annotation-driven />can detect already registered message converters. In my case I would like to customizeMappingJacksonHttpMessageConverterbut I can't do it easily, as this class is created new byAnnotationDrivenBeanDefinitionParser. I propose that (a) it should check the context for unknown implementations ofHttpMessageConverter's and (b) it should use already defined already customized beans for "known"HttpMessageConverter's (e.g.FormHttpMessageConverter, ...). Maybe this problem should be solved byAnnotationMethodHandlerAdapteritself, which can collect allHttpMessageConverter's just after context has been instantiated (ApplicationContextAware). Relative to #11850 and #11416, as having autodetection implemented solves them.spring-projects-issues commentedon Jan 25, 2011
Rossen Stoyanchev commented
This issue should be resolved with the completion of #12161.