Switch off DispatcherServlet on Spring Boot

I added below code into my main class, and the servlet was removed from log.

@SpringBootApplication(exclude = { DispatcherServletAutoConfiguration.class })

From Spring boot docs here

Spring Boot wants to serve all content from the root of your application / down. If you would rather map your own servlet to that URL you can do it, but of course you may lose some of the other Boot MVC features. To add your own servlet and map it to the root resource just declare a @Bean of type Servlet and give it the special bean name dispatcherServlet (You can also create a bean of a different type with that name if you want to switch it off and not replace it).