Affects: all versions
Spring already has the very nice StringHttpMessageConverter.
Sometimes it can be good to add simple endpoints that returns plain numbers. The developer could wrap it inside a json payload {count: 123}
but some people might prefer just returning plain text numbers. For that reason they can implement their own IntegerHttpMessageConverter and LongHttpMessageConverter but it might be good to just provide them out of box.
The implementation would basically be just a copy of https://github.com/spring-projects/spring-framework/blob/main/spring-web/src/main/java/org/springframework/http/converter/StringHttpMessageConverter.java but with the numbers being first converted to simple strings.
Comment From: bclozel
Thanks for the proposal, but we think that this use case is specific enough that applications should implement that themselves. Returning a String
version of numbers from the controller looks straightforward enough for this. I'm declining this enhancement as a result. Thanks for the proposal!
Comment From: lasselindqvist
Thats fair, but for some context: my use case was an autogenerated API from OpenAPI specs, where it is not "possible" to change the return type. But of course in this case also the application developer can just implement this Converter themselves.