diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java index 8c83702081f..e5aa015f1cb 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.Locale; import java.util.Map; import java.util.Map.Entry; +import java.util.TimeZone; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.databind.Module; @@ -206,7 +207,16 @@ public class JacksonAutoConfiguration { (DateFormat) BeanUtils.instantiateClass(dateFormatClass)); } catch (ClassNotFoundException ex) { - builder.dateFormat(new SimpleDateFormat(dateFormat)); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat); + // Since Jackson 2.6.3 we always need to set a TimeZone (see gh-4170) + // If none in our properties fallback to the Jackson's default + TimeZone timeZone = this.jacksonProperties.getTimeZone(); + if (timeZone == null) { + timeZone = new ObjectMapper().getSerializationConfig() + .getTimeZone(); + } + simpleDateFormat.setTimeZone(timeZone); + builder.dateFormat(simpleDateFormat); } } } diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index 1eefdc461e3..d41159088f2 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -86,7 +86,7 @@ 4.5.1 4.4.4 8.0.1.Final - 2.6.1 + 2.6.3 2.7.8 3.18.1-GA 1.0.0