File tree Expand file tree Collapse file tree 4 files changed +10
-4
lines changed
spring-boot-autoconfigure/src
main/java/org/springframework/boot/autoconfigure/jackson
test/java/org/springframework/boot/autoconfigure/jackson
spring-boot-docs/src/main/asciidoc Expand file tree Collapse file tree 4 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 20
20
import java .text .DateFormat ;
21
21
import java .text .SimpleDateFormat ;
22
22
import java .util .Collection ;
23
+ import java .util .Locale ;
23
24
import java .util .Map ;
24
25
import java .util .Map .Entry ;
25
26
64
65
* @author Andy Wilkinson
65
66
* @author Marcel Overdijk
66
67
* @author Sebastien Deleuze
68
+ * @author Johannes Stelzer
67
69
* @since 1.1.0
68
70
*/
69
71
@ Configuration
@@ -239,7 +241,7 @@ private void configureModules(Jackson2ObjectMapperBuilder builder) {
239
241
}
240
242
241
243
private void configureLocale (Jackson2ObjectMapperBuilder builder ) {
242
- String locale = this .jacksonProperties .getLocale ();
244
+ Locale locale = this .jacksonProperties .getLocale ();
243
245
if (locale != null ) {
244
246
builder .locale (locale );
245
247
}
Original file line number Diff line number Diff line change 17
17
package org .springframework .boot .autoconfigure .jackson ;
18
18
19
19
import java .util .HashMap ;
20
+ import java .util .Locale ;
20
21
import java .util .Map ;
21
22
import java .util .TimeZone ;
22
23
34
35
*
35
36
* @author Andy Wilkinson
36
37
* @author Marcel Overdijk
38
+ * @author Johannes Stelzer
37
39
* @since 1.2.0
38
40
*/
39
41
@ ConfigurationProperties (prefix = "spring.jackson" )
@@ -98,7 +100,7 @@ public class JacksonProperties {
98
100
/**
99
101
* Locale used for formatting.
100
102
*/
101
- private String locale ;
103
+ private Locale locale ;
102
104
103
105
public String getDateFormat () {
104
106
return this .dateFormat ;
@@ -160,11 +162,11 @@ public void setTimeZone(TimeZone timeZone) {
160
162
this .timeZone = timeZone ;
161
163
}
162
164
163
- public String getLocale () {
165
+ public Locale getLocale () {
164
166
return this .locale ;
165
167
}
166
168
167
- public void setLocale (String locale ) {
169
+ public void setLocale (Locale locale ) {
168
170
this .locale = locale ;
169
171
}
170
172
Original file line number Diff line number Diff line change 72
72
* @author Andy Wilkinson
73
73
* @author Marcel Overdijk
74
74
* @author Sebastien Deleuze
75
+ * @author Johannes Stelzer
75
76
*/
76
77
public class JacksonAutoConfigurationTests {
77
78
Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ content into your application; rather pick only the properties that you need.
176
176
spring.jackson.deserialization.*= # see Jackson's DeserializationFeature
177
177
spring.jackson.generator.*= # see Jackson's JsonGenerator.Feature
178
178
spring.jackson.joda-date-time-format= # Joda date time format string
179
+ spring.jackson.locale= # locale used for formatting
179
180
spring.jackson.mapper.*= # see Jackson's MapperFeature
180
181
spring.jackson.parser.*= # see Jackson's JsonParser.Feature
181
182
spring.jackson.serialization.*= # see Jackson's SerializationFeature
You can’t perform that action at this time.
0 commit comments