GH-1148 Add JavaTimeModule to ObjectMapper

This commit is contained in:
Oleg Zhurakousky
2024-06-12 16:07:34 +02:00
parent 8b66fd296e
commit 5e73a6824c
2 changed files with 6 additions and 0 deletions

View File

@@ -61,6 +61,10 @@
<artifactId>jackson-databind</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

View File

@@ -27,6 +27,7 @@ import java.util.stream.Collectors;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.google.gson.Gson;
import io.cloudevents.spring.messaging.CloudEventMessageConverter;
@@ -215,6 +216,7 @@ public class ContextFunctionCatalogAutoConfiguration {
private JsonMapper jackson(ApplicationContext context) {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(DeserializationFeature.FAIL_ON_TRAILING_TOKENS, true);
return new JacksonMapper(mapper);