Default Media Type application/xml is selected by default
Describe the bug
I wrote an interface,produces = {"application/json", "application/xml"}, consumes = {"application/json", "application/xml"}
When the springdoc version was 2.5.0, application/json was selected by default
But when I switched to 2.6.0, the default choice changed to application/xml
I haven't changed anything except the version number of springdoc and I would like to know how to configure the Media type to return to the default application/json value
When referring to the 5.1. springdoc-openapi core properties section, you can change the media type using springdoc.default-consumes-media-type and springdoc.default-produces-media-type.
Please add the following settings to see if they resolve the issue:
If you use properties, add:
springdoc.default-consumes-media-type=application/json
springdoc.default-produces-media-type=application/json
If you use yaml, add:
springdoc:
default-consumes-media-type: application/json
default-produces-media-type: application/json
Can you check if the same issue persists after adding these settings?
When referring to the 5.1. springdoc-openapi core properties section, you can change the media type using
springdoc.default-consumes-media-typeandspringdoc.default-produces-media-type.Please add the following settings to see if they resolve the issue:
springdoc.default-consumes-media-type=application/json springdoc.default-produces-media-type=application/jsonspringdoc: default-consumes-media-type: application/json default-produces-media-type: application/jsonCan you check if the same issue persists after adding these settings? Yes, I added the configuration, changed it to version 2.6.0, and forced the browser to clear the cache refresh, but the result was still application/xml selected by default
![]()
And when I rolled back to version 2.5.0, I reverted back to the default selection of application/json
@bnasslahsen I have identified the issue and submitted a PR to fix it. The problem with the media type order not being preserved, causing the default type not to be prioritized, has been addressed by using LinkedHashSet. I would appreciate it if you could review the PR.
#2672
Thank you.
We ran into this issue just now and are happy to see a resolution for it already merged into main. May I ask what is the next release date for springdoc that contains this fix? Thanks!
@cmark,
Most probably, after spring-boot 3.4 goes GA: https://calendar.spring.io/