Skip to content

Use SmartHttpMessageConverter over GenericHttpMessageConverter where possible#18075

Open
therepanic wants to merge 1 commit intospring-projects:mainfrom
therepanic:gh-18073
Open

Use SmartHttpMessageConverter over GenericHttpMessageConverter where possible#18075
therepanic wants to merge 1 commit intospring-projects:mainfrom
therepanic:gh-18073

Conversation

@therepanic
Copy link
Copy Markdown
Contributor

We want to use SmartHttpMessageConverter over GenericHttpMessageConverter.

To get there, we first need to see the classes where GenericHttpMessageConverter is still used. These are HttpConverters with the methods static GenericHttpMessageConverter<Object> getJsonMessageConverter(). If we directly replace the return value with SmartHttpMessageConverter, we will see that some classes directly use GenericHttpMessageConverter and its methods.

To do this, I decided to create a special adapter SmartGenericHttpMessageConverterAdapter into which we can pass GenericHttpMessageConverter and use it as SmartHttpMessageConverter. We need this for classes that inherit from GenericHttpMessageConverter. However, for those who use jackson3, we can directly return JacksonJsonHttpMessageConverter, which in turn inherits from SmartHttpMessageConverter.

Closes: gh-18073

* limitations under the License.
*/

package org.springframework.security.oauth2.core;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the location I chose for the adapter correct?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 19, 2025
@therepanic therepanic force-pushed the gh-18073 branch 2 times, most recently from 48990fd to 3517081 Compare October 19, 2025 17:26
…ere possible

Closes: spring-projectsgh-18073

Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When possible use SmartHttpMessageConverter over GenericHttpMessageConverter

2 participants