Skip to content

Commit d597a4d

Browse files
committed
Correct handling of disable-html-escaping
See gh-39504
1 parent 5746886 commit d597a4d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/gson/GsonAutoConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void customize(GsonBuilder builder) {
9393
map.from(properties::getFieldNamingPolicy).to(builder::setFieldNamingPolicy);
9494
map.from(properties::getPrettyPrinting).whenTrue().toCall(builder::setPrettyPrinting);
9595
map.from(properties::getLenient).whenTrue().toCall(builder::setLenient);
96-
map.from(properties::getDisableHtmlEscaping).whenFalse().toCall(builder::disableHtmlEscaping);
96+
map.from(properties::getDisableHtmlEscaping).whenTrue().toCall(builder::disableHtmlEscaping);
9797
map.from(properties::getDateFormat).to(builder::setDateFormat);
9898
}
9999

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/gson/GsonAutoConfigurationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ void withoutDisableHtmlEscaping() {
244244
void withDisableHtmlEscapingTrue() {
245245
this.contextRunner.withPropertyValues("spring.gson.disable-html-escaping:true").run((context) -> {
246246
Gson gson = context.getBean(Gson.class);
247-
assertThat(gson.htmlSafe()).isTrue();
247+
assertThat(gson.htmlSafe()).isFalse();
248248
});
249249
}
250250

251251
@Test
252252
void withDisableHtmlEscapingFalse() {
253253
this.contextRunner.withPropertyValues("spring.gson.disable-html-escaping:false").run((context) -> {
254254
Gson gson = context.getBean(Gson.class);
255-
assertThat(gson.htmlSafe()).isFalse();
255+
assertThat(gson.htmlSafe()).isTrue();
256256
});
257257
}
258258

0 commit comments

Comments
 (0)