File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
spring-boot-autoconfigure/src
main/java/org/springframework/boot/autoconfigure/gson
test/java/org/springframework/boot/autoconfigure/gson Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 20
20
21
21
import com .google .gson .Gson ;
22
22
import com .google .gson .GsonBuilder ;
23
+ import com .google .gson .Strictness ;
23
24
24
25
import org .springframework .boot .autoconfigure .AutoConfiguration ;
25
26
import org .springframework .boot .autoconfigure .EnableAutoConfiguration ;
@@ -92,7 +93,7 @@ public void customize(GsonBuilder builder) {
92
93
map .from (properties ::getLongSerializationPolicy ).to (builder ::setLongSerializationPolicy );
93
94
map .from (properties ::getFieldNamingPolicy ).to (builder ::setFieldNamingPolicy );
94
95
map .from (properties ::getPrettyPrinting ).whenTrue ().toCall (builder ::setPrettyPrinting );
95
- map .from (properties ::getLenient ).whenTrue ().toCall (builder :: setLenient );
96
+ map .from (properties ::getLenient ).whenTrue ().toCall (() -> builder . setStrictness ( Strictness . LENIENT ) );
96
97
map .from (properties ::getDisableHtmlEscaping ).whenTrue ().toCall (builder ::disableHtmlEscaping );
97
98
map .from (properties ::getDateFormat ).to (builder ::setDateFormat );
98
99
}
Original file line number Diff line number Diff line change 28
28
import com .google .gson .Gson ;
29
29
import com .google .gson .GsonBuilder ;
30
30
import com .google .gson .LongSerializationPolicy ;
31
+ import com .google .gson .Strictness ;
31
32
import org .junit .jupiter .api .Test ;
32
33
import org .skyscreamer .jsonassert .JSONAssert ;
33
34
@@ -212,23 +213,23 @@ void withPrettyPrintingFalse() {
212
213
void withoutLenient () {
213
214
this .contextRunner .run ((context ) -> {
214
215
Gson gson = context .getBean (Gson .class );
215
- assertThat (gson ).hasFieldOrPropertyWithValue ("lenient " , false );
216
+ assertThat (gson ).hasFieldOrPropertyWithValue ("strictness " , null );
216
217
});
217
218
}
218
219
219
220
@ Test
220
221
void withLenientTrue () {
221
222
this .contextRunner .withPropertyValues ("spring.gson.lenient:true" ).run ((context ) -> {
222
223
Gson gson = context .getBean (Gson .class );
223
- assertThat (gson ).hasFieldOrPropertyWithValue ("lenient " , true );
224
+ assertThat (gson ).hasFieldOrPropertyWithValue ("strictness " , Strictness . LENIENT );
224
225
});
225
226
}
226
227
227
228
@ Test
228
229
void withLenientFalse () {
229
230
this .contextRunner .withPropertyValues ("spring.gson.lenient:false" ).run ((context ) -> {
230
231
Gson gson = context .getBean (Gson .class );
231
- assertThat (gson ).hasFieldOrPropertyWithValue ("lenient " , false );
232
+ assertThat (gson ).hasFieldOrPropertyWithValue ("strictness " , null );
232
233
});
233
234
}
234
235
Original file line number Diff line number Diff line change @@ -471,7 +471,7 @@ bom {
471
471
site(" https://groovy-lang.org" )
472
472
}
473
473
}
474
- library(" Gson" , " 2.10.1 " ) {
474
+ library(" Gson" , " 2.11.0 " ) {
475
475
group(" com.google.code.gson" ) {
476
476
modules = [
477
477
" gson"
You can’t perform that action at this time.
0 commit comments