I have added the JS310 dependency to Maven and refreshed the dependencies:
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.13.0</version>
</dependency>
In the domain:
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
LocalDate start;
However, I am receiving this error:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type java.time.LocalDate not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling
The error is indicative and explains you haven't registered the JavaTimeModule
module like documented at datetime
: to register it you can for example do in this way (or other equivalent way explained in the link I added previously, dependly from the jackson library version you are using) :
ObjectMapper mapper = JsonMapper.builder()
.addModule(new JavaTimeModule())
.build();