Currently AbstractServletWebServerFactory is registering the default Servlet in all cases.

With a typical Spring Boot application: * embedded server * no JSPs * DispatcherServlet mapped on "/" * static resources being served from the classpath (not "WEB-INF")

The default Servlet doesn't seem to be used at all.

Moreover, to use that Servlet, developers need to configure Spring MVC to enable forwarding requests to the default Servlet if no Handler processed the request:

@EnableWebMvc
@Configuration(proxyBeanMethods = false)
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }
}

In this case I think we could create a new configuration property to enable/disable the registration of the default Servlet and maybe switch the default to false here?

Comment From: wilkinsona

Re-opening as we may want to polish the property name to remove the -. Two options:

  1. server.servlet.register-default-servlet
  2. server.servlet.defaultservlet.registered

I prefer 1 to 2 but only if we're confident that we won't want to add another default servlet property in the future.