mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Polish "Log context path at startup"
Closes gh-10544
This commit is contained in:
parent
f76479fb99
commit
dbea25fa8b
@ -156,7 +156,7 @@ public class JettyWebServer implements WebServer {
|
||||
this.started = true;
|
||||
JettyWebServer.logger
|
||||
.info("Jetty started on port(s) " + getActualPortsDescription()
|
||||
+ " with context path " + getContextPath());
|
||||
+ " with context path '" + getContextPath() + "'");
|
||||
}
|
||||
catch (WebServerException ex) {
|
||||
throw ex;
|
||||
|
@ -195,7 +195,7 @@ public class TomcatWebServer implements WebServer {
|
||||
this.started = true;
|
||||
TomcatWebServer.logger
|
||||
.info("Tomcat started on port(s): " + getPortsDescription(true)
|
||||
+ " with context path " + getContextPath());
|
||||
+ " with context path '" + getContextPath() + "'");
|
||||
}
|
||||
catch (ConnectorStartFailedException ex) {
|
||||
stopSilently();
|
||||
|
@ -158,7 +158,7 @@ public class UndertowServletWebServer implements WebServer {
|
||||
this.started = true;
|
||||
UndertowServletWebServer.logger
|
||||
.info("Undertow started on port(s) " + getPortsDescription()
|
||||
+ " with context path " + this.contextPath);
|
||||
+ " with context path '" + this.contextPath + "'");
|
||||
}
|
||||
catch (Exception ex) {
|
||||
try {
|
||||
|
@ -263,6 +263,15 @@ public abstract class AbstractServletWebServerFactoryTests {
|
||||
assertThat(getResponse(getLocalUrl("/say/hello"))).isEqualTo("Hello World");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void contextPathIsLoggedOnStartup() {
|
||||
AbstractServletWebServerFactory factory = getFactory();
|
||||
factory.setContextPath("/custom");
|
||||
this.webServer = factory.getWebServer(exampleServletRegistration());
|
||||
this.webServer.start();
|
||||
assertThat(this.output.toString()).containsOnlyOnce("with context path '/custom'");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void contextPathMustStartWithSlash() throws Exception {
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
|
Loading…
Reference in New Issue
Block a user