Move server.display-name configuration property
The `server.display-name` configuration property is used to configure the application display name for Servlet-based applications. This commit moves that property to: `server.servlet.application-display-name` and keeps the same defaults. Closes gh-8624
This commit is contained in:
parent
1dd7aa22b3
commit
0c1aac14a0
|
|
@ -68,11 +68,6 @@ public class ServerProperties {
|
|||
*/
|
||||
private InetAddress address;
|
||||
|
||||
/**
|
||||
* Display name of the application.
|
||||
*/
|
||||
private String displayName = "application";
|
||||
|
||||
@NestedConfigurationProperty
|
||||
private final ErrorProperties error = new ErrorProperties();
|
||||
|
||||
|
|
@ -131,14 +126,6 @@ public class ServerProperties {
|
|||
this.address = address;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public Boolean isUseForwardHeaders() {
|
||||
return this.useForwardHeaders;
|
||||
}
|
||||
|
|
@ -222,6 +209,11 @@ public class ServerProperties {
|
|||
*/
|
||||
private String contextPath;
|
||||
|
||||
/**
|
||||
* Display name of the application.
|
||||
*/
|
||||
private String applicationDisplayName = "application";
|
||||
|
||||
/**
|
||||
* Path of the main dispatcher servlet.
|
||||
*/
|
||||
|
|
@ -248,6 +240,14 @@ public class ServerProperties {
|
|||
return contextPath;
|
||||
}
|
||||
|
||||
public String getApplicationDisplayName() {
|
||||
return this.applicationDisplayName;
|
||||
}
|
||||
|
||||
public void setApplicationDisplayName(String displayName) {
|
||||
this.applicationDisplayName = displayName;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class DefaultServletWebServerFactoryCustomizer
|
|||
map.from(this.serverProperties::getAddress).to(factory::setAddress);
|
||||
map.from(this.serverProperties.getServlet()::getContextPath)
|
||||
.to(factory::setContextPath);
|
||||
map.from(this.serverProperties::getDisplayName).to(factory::setDisplayName);
|
||||
map.from(this.serverProperties.getServlet()::getApplicationDisplayName).to(factory::setDisplayName);
|
||||
map.from(this.serverProperties.getServlet()::getSession).to(factory::setSession);
|
||||
map.from(this.serverProperties::getSsl).to(factory::setSsl);
|
||||
map.from(this.serverProperties::getServlet).as(ServerProperties.Servlet::getJsp)
|
||||
|
|
|
|||
|
|
@ -977,6 +977,16 @@
|
|||
"level": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "server.display-name",
|
||||
"type" : "java.lang.String",
|
||||
"description" : "Display name of the application.",
|
||||
"defaultValue" : "application",
|
||||
"deprecation" : {
|
||||
"replacement" : "server.servlet.application-display-name",
|
||||
"level" : "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "server.jsp-servlet.class-name",
|
||||
"type": "java.lang.String",
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
|
|||
public void testCustomizeDisplayName() {
|
||||
ConfigurableServletWebServerFactory factory = mock(
|
||||
ConfigurableServletWebServerFactory.class);
|
||||
this.properties.setDisplayName("TestName");
|
||||
this.properties.getServlet().setApplicationDisplayName("TestName");
|
||||
this.customizer.customize(factory);
|
||||
verify(factory).setDisplayName("TestName");
|
||||
}
|
||||
|
|
@ -281,7 +281,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
|
|||
@Test
|
||||
public void customizeTomcatDisplayName() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("server.display-name", "MyBootApp");
|
||||
map.put("server.servlet.application-display-name", "MyBootApp");
|
||||
bindProperties(map);
|
||||
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
|
||||
this.customizer.customize(factory);
|
||||
|
|
|
|||
|
|
@ -165,7 +165,6 @@ content into your application. Rather, pick only the properties that you need.
|
|||
server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript # Comma-separated list of MIME types that should be compressed.
|
||||
server.compression.min-response-size=2048 # Minimum response size that is required for compression to be performed.
|
||||
server.connection-timeout= # Time that connectors wait for another HTTP request before closing the connection. When not set, the connector's container-specific default is used. Use a value of -1 to indicate no (that is, an infinite) timeout.
|
||||
server.display-name=application # Display name of the application.
|
||||
server.error.include-exception=false # Include the "exception" attribute.
|
||||
server.error.include-stacktrace=never # When to include a "stacktrace" attribute.
|
||||
server.error.path=/error # Path of the error controller.
|
||||
|
|
@ -192,6 +191,7 @@ content into your application. Rather, pick only the properties that you need.
|
|||
server.use-forward-headers= # Whether X-Forwarded-* headers should be applied to the HttpRequest.
|
||||
server.servlet.context-parameters.*= # Servlet context init parameters
|
||||
server.servlet.context-path= # Context path of the application.
|
||||
server.servlet.application-display-name=application # Display name of the application.
|
||||
server.servlet.jsp.class-name=org.apache.jasper.servlet.JspServlet # The class name of the JSP servlet.
|
||||
server.servlet.jsp.init-parameters.*= # Init parameters used to configure the JSP servlet.
|
||||
server.servlet.jsp.registered=true # Whether the JSP servlet is registered.
|
||||
|
|
|
|||
Loading…
Reference in New Issue