一 点睛
Tomcat属性配置文件在下D:\.m2\repos\org\springframework\boot\spring-boot-autoconfigure\1.3.7.RELEASE\spring-boot-autoconfigure-1.3.7.RELEASE-sources\org\springframework\boot\autoconfigure\web文件夹的ServerProperties配置类中定义,我们只需要在application.properties配置属性做配置即可。通用的Servlet容器配置都以"server"作为前置,而Tomcat特有配置以"server.tomcat"作为前缀。
二 相关代码解读
@ConfigurationProperties(prefix = "server", ignoreUnknownFields = true)
public class ServerProperties
implements EmbeddedServletContainerCustomizer, EnvironmentAware, Ordered {
//配置程序端口
private Integer port;
//配置绑定的IP
private InetAddress address;
//配置访问路径
private String contextPath;
private String displayName = "application";
@NestedConfigurationProperty
private ErrorProperties error = new ErrorProperties();
@NotNull
private String servl