From 17610c25233d3781c4c1715f6e5717ea2dc170d6 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 2 May 2013 16:09:30 +0200 Subject: [PATCH] Added note on non-thread-safety of Jackson's DateFormat support --- .../json/Jackson2ObjectMapperFactoryBean.java | 12 +++++++++--- .../json/JacksonObjectMapperFactoryBean.java | 6 +++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java index c9dc1580e2..bc0e428160 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java +++ b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java @@ -123,6 +123,8 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBeanNote: Setting this property makes the exposed {@link ObjectMapper} + * non-thread-safe, according to Jackson's thread safety rules. * @see #setSimpleDateFormat(String) */ public void setDateFormat(DateFormat dateFormat) { @@ -131,6 +133,8 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBeanNote: Setting this property makes the exposed {@link ObjectMapper} + * non-thread-safe, according to Jackson's thread safety rules. * @see #setDateFormat(DateFormat) */ public void setSimpleDateFormat(String format) { @@ -213,9 +217,11 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean /** * Define the format for date/time with the given {@link DateFormat}. + *

Note: Setting this property makes the exposed {@link ObjectMapper} + * non-thread-safe, according to Jackson's thread safety rules. * @see #setSimpleDateFormat(String) */ public void setDateFormat(DateFormat dateFormat) { @@ -114,6 +116,8 @@ public class JacksonObjectMapperFactoryBean implements FactoryBean /** * Define the date/time format with a {@link SimpleDateFormat}. + *

Note: Setting this property makes the exposed {@link ObjectMapper} + * non-thread-safe, according to Jackson's thread safety rules. * @see #setDateFormat(DateFormat) */ public void setSimpleDateFormat(String format) { @@ -134,8 +138,8 @@ public class JacksonObjectMapperFactoryBean implements FactoryBean * {@link org.codehaus.jackson.map.DeserializationConfig.Feature#AUTO_DETECT_FIELDS}. */ public void setAutoDetectFields(boolean autoDetectFields) { - this.features.put(DeserializationConfig.Feature.AUTO_DETECT_FIELDS, autoDetectFields); this.features.put(SerializationConfig.Feature.AUTO_DETECT_FIELDS, autoDetectFields); + this.features.put(DeserializationConfig.Feature.AUTO_DETECT_FIELDS, autoDetectFields); } /**