Spring Boot Undertow替换Tomcat

本文介绍如何在SpringBoot项目中使用Undertow替代Tomcat,以降低内存消耗,适合部署多应用主机。通过排除starter-tomcat并添加spring-boot-starter-undertow,详细展示了配置迁移和选择轻量级容器的过程。
摘要由CSDN通过智能技术生成

优化spring boot

Undertow是Wildfly的web服务器,性能不必多说,在嵌入微服务方面比tomcat更小。
gradle环境

configurations {
    compile.exclude module: 'spring-boot-starter-tomcat'
}
dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.boot:spring-boot-starter-undertow')
    // ...
}

maven环境

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-undertow</artifactId>
</dependency>

我一台主机要放多个应用,为了节省机器内存,所以选择更节省内存的容器,

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值