Skip to content

@EnableWebMvc And OpenApi Issue#

Notes#

  • Don't use annotation @EnableWebMvc if you are not using advance features of WebMvcConfigurer, in stead let extend directly from WebMvcConfigurationSupport. Because when you use @EnableWebMvc some default bean of Spring Boot will be overridden and it will cause of some issue that you won't expect.
  • For example, if you are using OpenApi generator and in some configuration file you use annotation @EnableWebMvc then you can see format datetime of openapi will response numbers as Epoch (Ex: 1702629738) not the type that human can read as 2011-12-03T10:15:30. It is because the default ObjectMapper of Spring Boot has been overridden and it is hard for you to reconfigure it again.