Stop registering the default servlet by default
Previously, the default servlet was registered automatically when using embedded Jetty, Tomcat, or Undertow. However, it is not used by the majority of applications where Spring MVC's DispatcherServlet will be the only servlet that's needed. As such configuring the default servlet was wasting CPU and memory. This commit changes the default for registering the default servlet to false. It can be re-enabled by setting server.servlet.register-default-servlet=true. Closes gh-22915
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -156,7 +156,9 @@ class RemoteClientConfigurationTests {
|
||||
|
||||
@Bean
|
||||
TomcatServletWebServerFactory tomcat() {
|
||||
return new TomcatServletWebServerFactory(0);
|
||||
TomcatServletWebServerFactory webServerFactory = new TomcatServletWebServerFactory(0);
|
||||
webServerFactory.setRegisterDefaultServlet(true);
|
||||
return webServerFactory;
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user