-   Notifications  You must be signed in to change notification settings 
- Fork 38.8k
Description
The builder class has two types of methods. There are a number that have override semantics:
- jsonMessageConverter(HttpMessageConverter<?>)
- stringMessageConverter(HttpMessageConverter<?>)
- xmlMessageConverter(HttpMessageConverter<?>)
- etc
And one that is additive:
- customMessageConverter(HttpMessageConverter<?>)
It's not clear from the method names that they have these different semantics. A contributing factor here is that the HttpMessageConverter contract doesn't use just the format (JSON, XML, etc) of the message, it also considers the type that's being read or written. That would suggest that it should be possible to register two JSON message converters that handle different types but doing so using jsonMessageConverter isn't possible and one or both of them must be registered using customMessageConverter instead.
After some discussion, @rstoyanchev suggested renaming the methods to be named set… for the overriding case and add… for the additive case. We also considered dropping Message for brevity:
- setJsonConverter(HttpMessageConverter<?>)
- setStringConverter(HttpMessageConverter<?>)
- setXmlConverter(HttpMessageConverter<?>)
- addCustomConverter(HttpMessageConverter<?>)