I use Spring Boot and included jackson-datatype-jsr310
with Maven:
com.fasterxml.jackson.datatype
If you use the dependency spring-boot-starter-web version 2.0.0.RELEASE
or higher, there is no longer needed to explicitely include jackson-datatype-jsr310
dependency, which is already provided with spring-boot-starter-web
through spring-boot-starter-json.
This was resolved as Spring Boot issue #9297 and the answer is still valid and relevant:
@RequestMapping(value = "datetime", method = RequestMethod.POST)
public void foo(@RequestParam("dateTime")
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime ldt) {
// IMPLEMENTATION
}