JAVA架构升级:JDK11 升级JDK21 Springboo2.5.14 升级至Springboo3.1.7

依赖升级

Gradle 7.5.1 ---> 8.5
intellij idea 2022.1 ---> 2023.3.2
Springboot 2.5.14 ---> 3.1.17
Lombok 1.18.24 ---> 1.18.30
hutool-all 5.1.1 ---> 5.8.23
springfox-swagger2 ---> springdoc 2.3.0
fastjson、fastjson2 ---> 2.0.45
dubbo 2.4.9  --->  2.6.9
druid 1.2.16  --->  1.2.21

问题记录

问题1、gradle 7.5.1 升级至8.5

Unsupported Java. 
Your build is currently configured to use Java 21.0.1 and Gradle 7.5.1.
Possible solution:
 - Use Java 18 as Gradle JVM: Open Gradle settings 
 - Upgrade Gradle wrapper to 8.5 version and re-import the project

问题2、intellij idea 由 2022.1 升级至 2023.3.2

问题3、springboot 版本支持问题 升级至3.1.7

id 'org.springframework.boot' version '3.1.7'
id 'io.spring.dependency-management' version '1.1.4'

问题4、lombok 升级至1.18.30

Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field ‘com.sun.tools.javac.tree.JCTree qualid’
处理:lombok版本兼容性的问题 :依赖更新新版 lombok 为 1.18.30 即可

compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.30'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.30'

问题5、javax. 包转为 jakarta. 包

错误: 找不到符号import javax.annotation.Resource;
错误: 程序包javax.servlet.http不存在import javax.servlet.http.HttpServletRequest;

处理新包路径引入

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;

在这里插入图片描述
在这里插入图片描述

问题6、本项目使用log4j2要排除logback依赖

//去除logback
implementation.exclude group: 'ch.qos.logback'

问题7、如依赖cn.hutool 升级至5.8.23+

cn.hutool:hutool-all 5.1.1 升级至5.8.23

问题8、springfox-swagger2 升级到 springdoc 2.3.0

文档:https://springdoc.org/index.html#javadoc-support

//补充javax 依赖
implementation 'javax.servlet:javax.servlet-api:4.0.1'

应用主类添加注解@EnableOpenApi (swagger2是@EnableSwagger2)
swagger配置类SwaggerProperties.class,与swagger2.xx 版本有差异,具体看下文
自定义一个配置类 SwaggerConfiguration.class,看下文
访问地址:http://localhost:8080/swagger-ui/index.html
(swagger2.xx版本访问的地址为http://localhost:8080/swagger-ui.html)

//替换为springdoc
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0'

问题9、fastjson fastjson2升级到 2.0.45

implementation "com.alibaba:fastjson:2.0.45"
implementation "com.alibaba.fastjson2:fastjson2:2.0.45"

问题10、‘dubbo’'2.4.9’升级至 2.6.9

implementation(group: 'com.alibaba', name: 'dubbo', version:'2.6.9')

问题11、 job center 由1.1.8 升级至1.1.15

// job
implementation(group: 'com.nxin.framework', name: 'job-center-client', version: '1.1.15')
implementation(group: 'com.nxin.framework', name: 'job-center-core', version: '1.1.15')

问题12、druid 1.2.16升级至 1.2.21

implementation 'com.alibaba:druid-spring-boot-starter:1.2.21'
implementation group: 'com.alibaba', name: 'druid', version:"$druidVersion"

问题13、redis 配置调整

#redis配置
spring.data.redis.host = ${redis}
spring.data.redis.port = 6379
spring.data.redis.password = ******
spring.data.redis.database = 12
spring.data.redis.timeout = 60000
spring.data.redis.lettuce.pool.max-wait = 30000
spring.data.redis.lettuce.pool.max-idle = 10
spring.data.redis.lettuce.pool.max-active = 10

补充14、mysql 依赖包调整 com.mysql:mysql-connector-j

//    runtimeOnly 'mysql:mysql-connector-java:8.0.33'
    runtimeOnly 'com.mysql:mysql-connector-j'
  • 33
    点赞
  • 33
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 你在创建SpringBoot项目时遇到的问题是无法找到org.springframework.boot:spring-boot-starter-parent:pom:2.2.0.RELEASE这个依赖包。根据引用中的错误提示,问题可能是由于无法建立到目标请求的有效认证路径而导致的。根据引用提到的第二种方法,你可以尝试手动导入安全证书到Java的cacerts证书库来解决这个问题。具体步骤是打开阿里源的网址(https://maven.aliyun.com/nexus/content/groups/public)或(https://maven.aliyun.com/repository/central),然后按照引用中的说明将安全证书导入到证书库中。这样就能解决找不到依赖包的问题了。 另外,你提到的问题是找不到artifact org.springframework.boot:spring-boot-starter-parent:pom:2.5.14.RELEASE在central仓库中,可能是因为该版本的依赖包在central仓库中不存在。你可以尝试查看其他可用的仓库或者使用其他版本的依赖包来解决这个问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [创建SpringBoot项目出现的问题(Could not transfer artifact org.springframework.boot:spring-boot-...](https://blog.csdn.net/weixin_43203310/article/details/126134054)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值