I want to use spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
to set the time format, but at the same time, my project has customized org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
, and theyyyy-MM-dd HH:mm:ss
is no longer effective
please see demo: https://github.com/brucelwl/demo/tree/bug
Digression: there are more and more redundant automatic assembly of Springboot
. I hope springboot can simplify these configuration classes, such as org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration
and org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
. Spring
has helped us to implement it
Comment From: mdeinum
Which is as expected. The usage of WebMvcConfigurationSupport
indicates to Spring Boot that you have configured the web part and it will stop applying the auto-configuration. With that it also stops configuring Jackson and thus the use of the spring.jackson.date-format
.
Instead of extending the WebMvcConfigurationSupport
your class should implement WebMvcConfigurer
and override the methods you need.
Comment From: brucelwl
Thanks @mdeinum
Comment From: snicoll
Thanks @mdeinum