From 1222ca38fb46a5c461fa41d2d4383469d10a2ede Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 7 Jul 2014 14:33:48 +0200 Subject: [PATCH] RestTemplate accepts getMessageConverters() List on setMessageConverters again Issue: SPR-11962 --- .../java/org/springframework/web/client/RestTemplate.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java b/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java index b69b49cef0..a3a86e92b1 100644 --- a/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java +++ b/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> messageConverters) { Assert.notEmpty(messageConverters, "'messageConverters' must not be empty"); - this.messageConverters.clear(); - this.messageConverters.addAll(messageConverters); + // Take getMessageConverters() List as-is when passed in here + if (this.messageConverters != messageConverters) { + this.messageConverters.clear(); + this.messageConverters.addAll(messageConverters); + } } /**