Skip to content

Update Javadoc and reference doc for WebMvcConfigurer to mention Boot's HttpMessageConverters #30538

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

Closed
joca-bt opened this issue May 24, 2023 · 1 comment
Assignees
Labels
type: documentation A documentation task
Milestone

Comments

@joca-bt
Copy link

joca-bt commented May 24, 2023

The documentation for configureMessageConverters states:

Note use of this method turns off default converter registration. Alternatively, use extendMessageConverters(java.util.List) to modify that default list of converters.

This does not seem to be the case. My expectation from the documentation is that if I defined this override, my application will just use the converters I register manually there. However, if I inspect the list it contains the default converters. I can clear the list but the behaviour doesn't seem to match the documentation.

I have attached a simple application that shows the issue (test.zip).

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 24, 2023
@joca-bt joca-bt changed the title configureMessageConverters of WebMvcConfigurer does not strictly to what is documented configureMessageConverters of WebMvcConfigurer does not strictly do what is documented May 24, 2023
@rstoyanchev
Copy link
Contributor

configureMessageConverters works as documented if used on its own. However, in a Boot application, the WebMvcAutoConfiguration adds message converters through its HttpMessageConverters mechanism, which by default includes any HttpMessageConverter beans, and default converters. So the way to customize this in a Boot application is through HttpMessageConverters, or use the extendMessageConverters which lets you customize the resulting list at the end.

I'll update the Javadoc to at least mention this, but aside from that it's expected behavior.

For future reference, please provide a Maven or Gradle configured sample. You can use https://start.spring.io/.

@rstoyanchev rstoyanchev self-assigned this May 30, 2023
@rstoyanchev rstoyanchev added type: documentation A documentation task and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels May 30, 2023
@rstoyanchev rstoyanchev added this to the 6.0.10 milestone May 30, 2023
@rstoyanchev rstoyanchev changed the title configureMessageConverters of WebMvcConfigurer does not strictly do what is documented Update Javadoc and reference doc for WebMvcConfigurer to mention Boots HttpMessageConvertersof configureMessageConverters in to qualify May 30, 2023
@rstoyanchev rstoyanchev changed the title Update Javadoc and reference doc for WebMvcConfigurer to mention Boots HttpMessageConvertersof configureMessageConverters in to qualify Update Javadoc and reference doc for WebMvcConfigurer to mention Boots HttpMessageConverters May 30, 2023
@rstoyanchev rstoyanchev changed the title Update Javadoc and reference doc for WebMvcConfigurer to mention Boots HttpMessageConverters Update Javadoc and reference doc for WebMvcConfigurer to mention Boot's HttpMessageConverters May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

3 participants