See gh-3600
This commit is contained in:
Stephane Nicoll 2015-07-27 15:12:13 +02:00
parent 64461bb978
commit 92871ea03e
4 changed files with 10 additions and 4 deletions

View File

@ -20,6 +20,7 @@ import java.lang.reflect.Field;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
@ -64,6 +65,7 @@ import com.fasterxml.jackson.datatype.joda.ser.DateTimeSerializer;
* @author Andy Wilkinson
* @author Marcel Overdijk
* @author Sebastien Deleuze
* @author Johannes Stelzer
* @since 1.1.0
*/
@Configuration
@ -239,7 +241,7 @@ public class JacksonAutoConfiguration {
}
private void configureLocale(Jackson2ObjectMapperBuilder builder) {
String locale = this.jacksonProperties.getLocale();
Locale locale = this.jacksonProperties.getLocale();
if (locale != null) {
builder.locale(locale);
}

View File

@ -17,6 +17,7 @@
package org.springframework.boot.autoconfigure.jackson;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
@ -34,6 +35,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
*
* @author Andy Wilkinson
* @author Marcel Overdijk
* @author Johannes Stelzer
* @since 1.2.0
*/
@ConfigurationProperties(prefix = "spring.jackson")
@ -98,7 +100,7 @@ public class JacksonProperties {
/**
* Locale used for formatting.
*/
private String locale;
private Locale locale;
public String getDateFormat() {
return this.dateFormat;
@ -160,11 +162,11 @@ public class JacksonProperties {
this.timeZone = timeZone;
}
public String getLocale() {
public Locale getLocale() {
return this.locale;
}
public void setLocale(String locale) {
public void setLocale(Locale locale) {
this.locale = locale;
}

View File

@ -72,6 +72,7 @@ import static org.mockito.Mockito.mock;
* @author Andy Wilkinson
* @author Marcel Overdijk
* @author Sebastien Deleuze
* @author Johannes Stelzer
*/
public class JacksonAutoConfigurationTests {

View File

@ -176,6 +176,7 @@ content into your application; rather pick only the properties that you need.
spring.jackson.deserialization.*= # see Jackson's DeserializationFeature
spring.jackson.generator.*= # see Jackson's JsonGenerator.Feature
spring.jackson.joda-date-time-format= # Joda date time format string
spring.jackson.locale= # locale used for formatting
spring.jackson.mapper.*= # see Jackson's MapperFeature
spring.jackson.parser.*= # see Jackson's JsonParser.Feature
spring.jackson.serialization.*= # see Jackson's SerializationFeature