Spring Boot中以文件方式配置Tomcat

一 点睛

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值