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
Registering an HttpMessageConverter while preserving default converters [SPR-12450] #17055
Comments
Christopher Smith commented Upon reflection, what I've asked for isn't really quite what I want. I want the ability to additively register an Alternatively or in addition, configuring this for a specific controller instead of globally would solve my use case. The existing controller advice (particularly |
Rossen Stoyanchev commented Multiple |
Christopher Smith commented Correct. Essentially, think of a "mixin" module like Spring Boot Actuator: It registers a controller independent of the main application. In this case, however, I need a custom converter to handle some weird JSON deserialization and don't want to otherwise modify the MVC configuration. If you just add in my mixin and it automatically registers that converter, the regular old JSON and form converters stop working, and |
Rossen Stoyanchev commented I completely see the motivation for the request. Having "add" and "configure" methods next to each other however is confusing considering that "configure" is also additive across multiple WebMvcConfigurer instances. The difference is more subtle and practically boils down to default converter registration. Instead we could have |
Rossen Stoyanchev commented This is now available to try in a 4.1.3.BUILD-SNAPSHOT from http://repo.spring.io/snapshot. See commit 24834f for details. |
Christopher Smith commented
|
Rossen Stoyanchev commented Yes, it should be. This is in WebMvcConfigurationSupport#getMessageConverters. |
Christopher Smith opened SPR-12450 and commented
I am the maintainer for a component library that adds an embedded postback listener controller to some larger application. This controller needs a custom
HttpMessageConverter
due to quirky JSON supplied by the caller.There is currently no distributed way to add HTTP converters to the Web configuration. The current best recommendation is to do something like call
addDefaultHttpMessageConverters
(#14257), but this component is not responsible for the overall configuration of the application.I would like an annotation-based approach for configuring HTTP converters that could collect components from independent modules and apply them all without explicit coordination.
Affects: 4.1.2
Referenced from: commits 24834f6
The text was updated successfully, but these errors were encountered: