Skip to content

Provide a property to disable configuration of the default servlet #21214

@bclozel

Description

@bclozel

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?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions