0

No converter found for return value of type: class java.time.LocalDateTime

 @RequestMapping("/hello2")
    @ResponseBody
    public LocalDateTime handleRequest2(@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)LocalDateTime dateTime) throws Exception {

        return dateTime;
    }

(well ,i konw can write the return type as String) ,i guess spring framework have an util whic can convert an object to string , i just want to know how can i do ,to make the datetime convert string json.

lhz1165
  • 67
  • 1
  • 8

1 Answers1

1

Add the below dependency to your pom.xml :

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.10.0.pr3</version>
</dependency>

It would give you options to achieve what you want!

Amit kumar
  • 2,169
  • 10
  • 25
  • 36