Spring + Jackson + joda time: how to specify the serialization/deserialization format?

后端 未结 1 1800
你的背包
你的背包 2021-01-06 03:45

I have the following class:

public static class ARestRequestParam
{
    String name;
    LocalDate date;  // joda type
}

And I want it to b

1条回答
  •  走了就别回头了
    2021-01-06 04:06

    Your code is OK, but if you use @EnableWebMvc in a Spring Boot app you switch off the default settings in the framework, so maybe you should avoid that. Also, you now have only one HttpMessageConverter in your MVC handler adapter. If you use a snapshot of Spring Boot you ought to be able to simply define a @Bean of type Module and everything else would be automatic, so I would recommend doing it that way.

    0 讨论(0)
提交回复
热议问题