SpringBoot Global Jackson configuration does not take effect

In doing a small project, built with back-office services for the first time SpringBoot. Json interface format, arranged in application.properties follows:

spring.jackson.default-property-inclusion=NON_NULL

spring.jackson.time-zone=GMT+8

spring.jackson.date-format=yyyy-MM-dd HH:mm:ss

Test, there is not even entered into force, Json data, there are still null attributes, date still plastic figures. Bean set Jackson annotations are effective, but always felt tedious and repetitive. Later repeatedly check the information and testing, and finally found the problem.

Finally, if you opt out of the Spring Boot default MVC configuration by providing your own @EnableWebMvc configuration, you can take control completely and do everything manually by using getMessageConverters from WebMvcConfigurationSupport.

《Spring Boot Reference Guide》 

Remove @EnableWebMvc, really everything is OK.

Guess you like

Origin www.cnblogs.com/qingmuchuanqi48/p/11917027.html