Browse Source

RestTemplate accepts getMessageConverters() List on setMessageConverters again

Issue: SPR-11962
pull/584/merge
Juergen Hoeller 11 years ago
parent
commit
1222ca38fb
  1. 7
      spring-web/src/main/java/org/springframework/web/client/RestTemplate.java

7
spring-web/src/main/java/org/springframework/web/client/RestTemplate.java

@ -202,8 +202,11 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
*/ */
public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters) { public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
Assert.notEmpty(messageConverters, "'messageConverters' must not be empty"); Assert.notEmpty(messageConverters, "'messageConverters' must not be empty");
this.messageConverters.clear(); // Take getMessageConverters() List as-is when passed in here
this.messageConverters.addAll(messageConverters); if (this.messageConverters != messageConverters) {
this.messageConverters.clear();
this.messageConverters.addAll(messageConverters);
}
} }
/** /**

Loading…
Cancel
Save