Reputation: 503
is there way to add http message converter to RestTemplate in Spring Boot by configuration?
I would like to just add new message converted and do not remove the existing ones.
This will remove existing one.
@Bean
RestTemplate restTemplate(ProtobufHttpMessageConverter hmc) {
return new RestTemplate(Arrays.asList(hmc));
}
Upvotes: 1
Views: 1568
Reputation: 116311
You can add an extra converter like this:
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(hmc);
Upvotes: 2