使用Java8日期格式的Spring引导

使用Java8日期格式的Spring引导,java,spring-boot,Java,Spring Boot,我正在尝试将Java8LocalDate与springboot结合使用 我把 compile ("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") 内特格拉德尔酒店 及 在物业方面,我有: spring.jackson.date-format=dd/MM/yyyy HH:mm:ss 但不工作,当我尝试发布时,我出现以下错误: { "timestamp": "02/09/2015 11:32:15", "status":

我正在尝试将Java8LocalDate与springboot结合使用

我把

compile ("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
内特格拉德尔酒店

在物业方面,我有:

spring.jackson.date-format=dd/MM/yyyy HH:mm:ss
但不工作,当我尝试发布时,我出现以下错误:

{
  "timestamp": "02/09/2015 11:32:15",
  "status": 400,
  "error": "Bad Request",
  "exception": "org.springframework.http.converter.HttpMessageNotReadableException",
  "message": "Could not read document: Text '10/10/2015' could not be parsed at index 0 (through reference chain: br.com.lumera.entity.Feriado[\"dia\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Text '10/10/2015' could not be parsed at index 0 (through reference chain: br.com.lumera.entity.Feriado[\"dia\"])",
  "path": "/atos/feriado/"
}
我怎样才能解决这个问题


tks

默认情况下,LocalDateDeserializer类接受的格式为yyyy-mm-dd。您必须修改前端组件,使其相应地格式化日期。如果要在序列化程序/反序列化程序中指定不同的格式,则必须使用自定义java.time.format.DateTimeFormatter对其进行实例化

{
  "timestamp": "02/09/2015 11:32:15",
  "status": 400,
  "error": "Bad Request",
  "exception": "org.springframework.http.converter.HttpMessageNotReadableException",
  "message": "Could not read document: Text '10/10/2015' could not be parsed at index 0 (through reference chain: br.com.lumera.entity.Feriado[\"dia\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Text '10/10/2015' could not be parsed at index 0 (through reference chain: br.com.lumera.entity.Feriado[\"dia\"])",
  "path": "/atos/feriado/"
}