Skip to content

Commit 92871ea

Browse files
committed
1 parent 64461bb commit 92871ea

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.text.DateFormat;
2121
import java.text.SimpleDateFormat;
2222
import java.util.Collection;
23+
import java.util.Locale;
2324
import java.util.Map;
2425
import java.util.Map.Entry;
2526

@@ -64,6 +65,7 @@
6465
* @author Andy Wilkinson
6566
* @author Marcel Overdijk
6667
* @author Sebastien Deleuze
68+
* @author Johannes Stelzer
6769
* @since 1.1.0
6870
*/
6971
@Configuration
@@ -239,7 +241,7 @@ private void configureModules(Jackson2ObjectMapperBuilder builder) {
239241
}
240242

241243
private void configureLocale(Jackson2ObjectMapperBuilder builder) {
242-
String locale = this.jacksonProperties.getLocale();
244+
Locale locale = this.jacksonProperties.getLocale();
243245
if (locale != null) {
244246
builder.locale(locale);
245247
}

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonProperties.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.boot.autoconfigure.jackson;
1818

1919
import java.util.HashMap;
20+
import java.util.Locale;
2021
import java.util.Map;
2122
import java.util.TimeZone;
2223

@@ -34,6 +35,7 @@
3435
*
3536
* @author Andy Wilkinson
3637
* @author Marcel Overdijk
38+
* @author Johannes Stelzer
3739
* @since 1.2.0
3840
*/
3941
@ConfigurationProperties(prefix = "spring.jackson")
@@ -98,7 +100,7 @@ public class JacksonProperties {
98100
/**
99101
* Locale used for formatting.
100102
*/
101-
private String locale;
103+
private Locale locale;
102104

103105
public String getDateFormat() {
104106
return this.dateFormat;
@@ -160,11 +162,11 @@ public void setTimeZone(TimeZone timeZone) {
160162
this.timeZone = timeZone;
161163
}
162164

163-
public String getLocale() {
165+
public Locale getLocale() {
164166
return this.locale;
165167
}
166168

167-
public void setLocale(String locale) {
169+
public void setLocale(Locale locale) {
168170
this.locale = locale;
169171
}
170172

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
* @author Andy Wilkinson
7373
* @author Marcel Overdijk
7474
* @author Sebastien Deleuze
75+
* @author Johannes Stelzer
7576
*/
7677
public class JacksonAutoConfigurationTests {
7778

spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ content into your application; rather pick only the properties that you need.
176176
spring.jackson.deserialization.*= # see Jackson's DeserializationFeature
177177
spring.jackson.generator.*= # see Jackson's JsonGenerator.Feature
178178
spring.jackson.joda-date-time-format= # Joda date time format string
179+
spring.jackson.locale= # locale used for formatting
179180
spring.jackson.mapper.*= # see Jackson's MapperFeature
180181
spring.jackson.parser.*= # see Jackson's JsonParser.Feature
181182
spring.jackson.serialization.*= # see Jackson's SerializationFeature

0 commit comments

Comments
 (0)