Merge branch '2.2.x'

Closes gh-19435
pull/19437/head
Stephane Nicoll 5 years ago
commit 5031e6182b

@ -88,6 +88,7 @@ public class JacksonAutoConfiguration {
static {
Map<Object, Boolean> featureDefaults = new HashMap<>();
featureDefaults.put(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
featureDefaults.put(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS, false);
FEATURE_DEFAULTS = Collections.unmodifiableMap(featureDefaults);
}

@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.jackson;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
@ -378,6 +379,15 @@ class JacksonAutoConfigurationTests {
});
}
@Test
void writeDurationAsTimestampsDefault() {
this.contextRunner.run((context) -> {
ObjectMapper mapper = context.getBean(ObjectMapper.class);
Duration duration = Duration.ofHours(2);
assertThat(mapper.writeValueAsString(duration)).isEqualTo("\"PT2H\"");
});
}
@Test
void writeWithVisibility() {
this.contextRunner

Loading…
Cancel
Save