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;
|
private InetAddress address;
|
||||||
|
|
||||||
/**
|
|
||||||
* Display name of the application.
|
|
||||||
*/
|
|
||||||
private String displayName = "application";
|
|
||||||
|
|
||||||
@NestedConfigurationProperty
|
@NestedConfigurationProperty
|
||||||
private final ErrorProperties error = new ErrorProperties();
|
private final ErrorProperties error = new ErrorProperties();
|
||||||
|
|
||||||
|
|
@ -131,14 +126,6 @@ public class ServerProperties {
|
||||||
this.address = address;
|
this.address = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDisplayName() {
|
|
||||||
return this.displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDisplayName(String displayName) {
|
|
||||||
this.displayName = displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean isUseForwardHeaders() {
|
public Boolean isUseForwardHeaders() {
|
||||||
return this.useForwardHeaders;
|
return this.useForwardHeaders;
|
||||||
}
|
}
|
||||||
|
|
@ -222,6 +209,11 @@ public class ServerProperties {
|
||||||
*/
|
*/
|
||||||
private String contextPath;
|
private String contextPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display name of the application.
|
||||||
|
*/
|
||||||
|
private String applicationDisplayName = "application";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Path of the main dispatcher servlet.
|
* Path of the main dispatcher servlet.
|
||||||
*/
|
*/
|
||||||
|
|
@ -248,6 +240,14 @@ public class ServerProperties {
|
||||||
return contextPath;
|
return contextPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getApplicationDisplayName() {
|
||||||
|
return this.applicationDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplicationDisplayName(String displayName) {
|
||||||
|
this.applicationDisplayName = displayName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPath() {
|
public String getPath() {
|
||||||
return this.path;
|
return this.path;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public class DefaultServletWebServerFactoryCustomizer
|
||||||
map.from(this.serverProperties::getAddress).to(factory::setAddress);
|
map.from(this.serverProperties::getAddress).to(factory::setAddress);
|
||||||
map.from(this.serverProperties.getServlet()::getContextPath)
|
map.from(this.serverProperties.getServlet()::getContextPath)
|
||||||
.to(factory::setContextPath);
|
.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.getServlet()::getSession).to(factory::setSession);
|
||||||
map.from(this.serverProperties::getSsl).to(factory::setSsl);
|
map.from(this.serverProperties::getSsl).to(factory::setSsl);
|
||||||
map.from(this.serverProperties::getServlet).as(ServerProperties.Servlet::getJsp)
|
map.from(this.serverProperties::getServlet).as(ServerProperties.Servlet::getJsp)
|
||||||
|
|
|
||||||
|
|
@ -977,6 +977,16 @@
|
||||||
"level": "error"
|
"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",
|
"name": "server.jsp-servlet.class-name",
|
||||||
"type": "java.lang.String",
|
"type": "java.lang.String",
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
|
||||||
public void testCustomizeDisplayName() {
|
public void testCustomizeDisplayName() {
|
||||||
ConfigurableServletWebServerFactory factory = mock(
|
ConfigurableServletWebServerFactory factory = mock(
|
||||||
ConfigurableServletWebServerFactory.class);
|
ConfigurableServletWebServerFactory.class);
|
||||||
this.properties.setDisplayName("TestName");
|
this.properties.getServlet().setApplicationDisplayName("TestName");
|
||||||
this.customizer.customize(factory);
|
this.customizer.customize(factory);
|
||||||
verify(factory).setDisplayName("TestName");
|
verify(factory).setDisplayName("TestName");
|
||||||
}
|
}
|
||||||
|
|
@ -281,7 +281,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
|
||||||
@Test
|
@Test
|
||||||
public void customizeTomcatDisplayName() {
|
public void customizeTomcatDisplayName() {
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put("server.display-name", "MyBootApp");
|
map.put("server.servlet.application-display-name", "MyBootApp");
|
||||||
bindProperties(map);
|
bindProperties(map);
|
||||||
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
|
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
|
||||||
this.customizer.customize(factory);
|
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.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.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.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-exception=false # Include the "exception" attribute.
|
||||||
server.error.include-stacktrace=never # When to include a "stacktrace" attribute.
|
server.error.include-stacktrace=never # When to include a "stacktrace" attribute.
|
||||||
server.error.path=/error # Path of the error controller.
|
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.use-forward-headers= # Whether X-Forwarded-* headers should be applied to the HttpRequest.
|
||||||
server.servlet.context-parameters.*= # Servlet context init parameters
|
server.servlet.context-parameters.*= # Servlet context init parameters
|
||||||
server.servlet.context-path= # Context path of the application.
|
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.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.init-parameters.*= # Init parameters used to configure the JSP servlet.
|
||||||
server.servlet.jsp.registered=true # Whether the JSP servlet is registered.
|
server.servlet.jsp.registered=true # Whether the JSP servlet is registered.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue