首页 > 其他分享 >简单的spring boot tomcat版本升级

简单的spring boot tomcat版本升级

时间:2024-08-14 16:23:27浏览次数:9  
标签:tomcat spring boot 版本升级 版本 org embed starter

简单的spring boot tomcat版本升级

1. 需求

我们使用的springboot版本为2.3.8.RELEASE,对应的tomcat版本为9.0.41,公司tomcat对应版本发现攻击者可发送不完整的POST请求触发错误响应,从而可能导致获取其他用户先前请求的数据,造成信息泄露的bug,行方要求对tomcat版本进行升级,受影响版本如下:

Apache Tomcat 9.0.0-M11 至 9.0.43
Apache Tomcat 8.5.7 至 8.5.63

由上所示,我们公司决定将tomcat升级一个小版本升级到9.0.44版本,解决对应问题。

2.具体操作

具体操作分为如下几步

  1. 确定自己使用tomcat版本号,查看是否需要升级
  2. 移除tomcat错误版本编号,引入新的版本tomcat相关pom坐标
  3. 进行服务启动测试,查看版本编号是否修改成功

2.1 确定当前tomcat使用版本号

  • 首先我们需要确定自己对应的tomcat版本编号,可以使用右键点击进入spring-boot-starter-parent
    在这里插入图片描述
  • 然后再右键点击进入spring-boot-dependencies
    在这里插入图片描述
  • 然后我们在里面发现tomcat引入的jar包,再次进行右键点击spring-boot-starter-tomcat
    在这里插入图片描述
  • 最终发现tomcat版本为9.0.41,版本在漏洞版本中,所以需要升级
    在这里插入图片描述
  • 具体升级版本
    我们具体可以升级到设么版本,需要确定一下,可以使用maven的公共仓库mvnrepository确定一下到底支持哪些版本,通过在仓库中搜索spring-boot-starter-tomcat,找到对应的2.3.8.RELEASE版本,我们可以看到他的支持版本范围,具体访问地址
    在这里插入图片描述

注意:确定当前版本信息也可以使用maven的dependences树状依赖,查看依赖关系,此处我已经修改完了所以展示的页面也是修改完之后正确的tomcat版本
在这里插入图片描述

还可以使用maven冲突解决工具进行树结构查看,这里不多赘述了
在这里插入图片描述

2.2 移除starter-web模块对tomcat的依赖并引入新依赖

主要操作为pom文件中的starter-web,以及引入新的依赖,具体的pom文件如下所示,在maven对应的根pom中引入新版tomcat版本号 <tomcat.version>9.0.44</tomcat.version>
在这里插入图片描述我们项目有一个common模块,他统一引入starter-web模块,我们修改此处即可,其他引用模块则自动更新tomcat版本,具体pom信息如下

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>credit-business</artifactId>
        <groupId>cn.git</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>business-common</artifactId>
    <description>公共模块,业务依赖基础模块,提供基础的技术和业务支撑</description>

    <dependencies>
        <!-- feign 调用通用interceptor,保证调用header token 值不丢失 -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
        </dependency>
        <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>
                <exclusion>
                    <groupId>org.apache.tomcat.embed</groupId>
                    <artifactId>tomcat-embed-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.tomcat.embed</groupId>
                    <artifactId>tomcat-embed-el</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.tomcat.embed</groupId>
                    <artifactId>tomcat-embed-websocket</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-annotations-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- tomcat 修复漏洞 -->
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-core</artifactId>
            <version>${tomcat.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-annotations-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-annotations-api</artifactId>
            <version>${tomcat.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-el</artifactId>
            <version>${tomcat.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-websocket</artifactId>
            <version>${tomcat.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat.embed</groupId>
                    <artifactId>tomcat-embed-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>cn.git</groupId>
            <artifactId>credit-swagger-starter</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <dependency>
            <groupId>cn.git</groupId>
            <artifactId>credit-oracle-starter</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>cn.git</groupId>
            <artifactId>credit-redis-starter</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <!-- ftp上传下载-->
        <dependency>
            <groupId>commons-net</groupId>
            <artifactId>commons-net</artifactId>
            <version>3.7</version>
        </dependency>
        <dependency>
            <groupId>cn.git</groupId>
            <artifactId>credit-discovery-starter</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
        </dependency>
    </dependencies>
</project>

2.3 测试

其实前面的maven树以及依赖树已经证实 tomcat版本已经修改了,但是还是启动一下服务确定一下为好,那么再次启动服务,发现版本编号已经修改
在这里插入图片描述

标签:tomcat,spring,boot,版本升级,版本,org,embed,starter
From: https://blog.csdn.net/qq_19342829/article/details/141192902

相关文章

  • k8s中配置Spring Cloud服务(Eureka客户端)优雅上下线
    目录背景解决办法Pod容器终止流程模拟请求报错发布服务请求接口基于Eureka优雅上下线正确的做法修改deployment配置发布服务背景在Kubernetes部署应用时,尽管Kubernetes使用滚动升级的方式,先启动一个新Pod,等新Pod成功运行后再删除旧Pod,但在此过程中,Pod仍然会接收请求。如果在Pod......
  • springboot+vue《区块链技术与应用》课程案例信息资源系统【程序+论文+开题】-计算机
    系统程序文件列表开题报告内容研究背景随着信息技术的飞速发展,教育领域正经历着前所未有的变革。区块链技术,作为新兴的去中心化、透明度高、安全性强的分布式账本技术,正逐渐渗透到各行各业,其在教育领域的应用潜力尤为巨大。当前,高校教学中案例资源的共享与管理面临着信息孤......
  • springboot+vue《计算机网络》课程学习网【程序+论文+开题】-计算机毕业设计
    系统程序文件列表开题报告内容研究背景随着信息技术的飞速发展,网络教育已成为现代教育体系不可或缺的一部分。特别是在全球疫情的影响下,线上学习模式更是得到了前所未有的普及与重视。《计算机网络》作为计算机科学与技术专业的核心课程,其内容的广泛性和复杂性要求学生不仅......
  • springboot+vue《花间故里》【程序+论文+开题】-计算机毕业设计
    系统程序文件列表开题报告内容研究背景在快节奏的现代生活中,人们越来越追求心灵的宁静与自然的美好,花卉作为大自然的馈赠,不仅美化环境,更承载着丰富的情感与文化内涵。《花间故里》项目应运而生,旨在打造一个集花卉知识普及、个性化推荐、在线购买及社区交流于一体的综合性平......
  • springboot+vue《Python数据分析》的教学系统【程序+论文+开题】-计算机毕业设计
    系统程序文件列表开题报告内容研究背景随着大数据时代的到来,数据分析技能已成为各行各业不可或缺的核心竞争力之一。Python,作为一门高效、灵活且拥有丰富数据分析库的编程语言,正逐步成为数据分析领域的主流工具。然而,当前高等教育体系中,《Python数据分析》课程的教学仍面临......
  • 学习Java的日子 Day68 jQuery操作节点,Bootstrap
    jQuery1.jQuery操作DOMDOM为文档提供了一种结构化表示方法,通过该方法可以改变文档的内容和展示形式在访问页面时,需要与页面中的元素进行交互式的操作。在操作中,元素的访问是最频繁、最常用的,主要包括对元素属性attr、内容html、值value、CSS的操作1.1操作内容获取......
  • 基于SpringBoot的校园招聘系统+论文参考示例
    1.项目介绍技术栈+工具:SpringBoot+MyBatis-Plus+JSP+Maven+IDEA2022+MySQL系统角色:管理员、企业、普通用户(学生)系统功能:管理员(用户管理、企业管理、实体管理、岗位管理等)、企业(简历搜集、推荐简历查看、投递简历查看、发布职位、信息维护等)、普通用户(职位查询......
  • springboot+vue网上动物园售票系统的设计与实现【程序+论文+开题】-计算机毕业设计
    系统程序文件列表开题报告内容研究背景随着互联网技术的飞速发展,数字化转型已成为各行各业不可逆转的趋势。在旅游业中,特别是以动物园为代表的休闲娱乐场所,传统的售票模式逐渐暴露出效率低下、排队时间长、信息更新不及时等弊端。游客对于便捷、高效的购票体验有着日益增长......
  • springboot+vue网上订餐系统【程序+论文+开题】-计算机毕业设计
    系统程序文件列表开题报告内容研究背景随着互联网技术的飞速发展,人们的生活方式正经历着前所未有的变革。在快节奏的现代生活中,餐饮消费作为日常不可或缺的一部分,其服务模式也逐渐向便捷化、智能化转型。传统的餐饮消费往往需要顾客亲自前往餐厅,不仅耗费时间,还可能受限于地......
  • springboot+vue网络相册设计与实现【程序+论文+开题】-计算机毕业设计
    系统程序文件列表开题报告内容研究背景随着互联网技术的飞速发展,数字化生活已成为现代社会的常态。在这个背景下,个人影像资料的存储与分享需求日益增长。传统相册因其实体性、不便携带及难以共享等局限性,已难以满足用户随时随地记录生活、分享美好瞬间的需求。因此,网络相册......