ruoyi-nbcio从spring2.7.18升级springboot到3.1.7,java从java8升级到17(一)

本文涉及的产品
Redis 开源版,标准版 2GB
推荐场景:
搭建游戏排行榜
云数据库 Tair(兼容Redis),内存型 2GB
简介: ruoyi-nbcio从spring2.7.18升级springboot到3.1.7,java从java8升级到17(一)

更多ruoyi-nbcio功能请看演示系统

gitee源代码地址

前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio

演示地址: http://218.75.87.38:9666

更多nbcio-boot功能请看演示系统

gitee源代码地址

后端代码: https://gitee.com/nbacheng/nbcio-boot

前端代码:https://gitee.com/nbacheng/nbcio-vue.git

在线演示(包括H5) : http://218.75.87.38:9888

1、环境升级到java17

2、相关pom.xml版本进行升级

3、不过最好还是升级时候加一个下面升级包,这样有什么问题提示的好一些,当然升级好后要去掉下面这个

<dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-properties-migrator</artifactId>
              <scope>runtime</scope>
            </dependency>

4、原来很多javax.要修改成jakarta.开头的包,因为升级后变了,但有些sql之类还是要用javax.

编译通过后,运行出现下面错误

2024-02-23 21:58:40[0;39m [32m[main][0;39m [34mINFO [0;39m [1;35mcom.ruoyi.RuoYiApplication
[0;39m - The following 1 profile is active: "dev"
[31m2024-02-23 21:58:41[0;39m [32m[main][0;39m [31mWARN [0;39m [1;35mo.s.c.LocalVariableTableParameterNameDiscoverer
[0;39m - Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: com.ruoyi.framework.aspectj.LogAspect
[31m2024-02-23 21:58:41[0;39m [32m[main][0;39m [31mWARN [0;39m [1;35mo.s.c.LocalVariableTableParameterNameDiscoverer
[0;39m - Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: com.ruoyi.framework.aspectj.LogAspect
[31m2024-02-23 21:58:41[0;39m [32m[main][0;39m [31mWARN [0;39m [1;35mo.s.c.LocalVariableTableParameterNameDiscoverer
[0;39m - Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: com.ruoyi.framework.aspectj.RateLimiterAspect
[31m2024-02-23 21:58:41[0;39m [32m[main][0;39m [31mWARN [0;39m [1;35mo.s.c.LocalVariableTableParameterNameDiscoverer
[0;39m - Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: com.ruoyi.framework.aspectj.RepeatSubmitAspect
[31m2024-02-23 21:58:41[0;39m [32m[main][0;39m [31mWARN [0;39m [1;35mo.s.c.LocalVariableTableParameterNameDiscoverer
[0;39m - Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: com.ruoyi.framework.aspectj.RepeatSubmitAspect
[31m2024-02-23 21:58:41[0;39m [32m[main][0;39m [31mWARN [0;39m [1;35mo.s.c.LocalVariableTableParameterNameDiscoverer
[0;39m - Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: com.ruoyi.framework.aspectj.RepeatSubmitAspect
[31m2024-02-23 21:58:42[0;39m [32m[main][0;39m [34mINFO [0;39m [1;35mio.undertow.servlet
[0;39m - Initializing Spring embedded WebApplicationContext
[31m2024-02-23 21:58:42[0;39m [32m[main][0;39m [31mWARN [0;39m [1;35mo.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext
[0;39m - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'captchaController' defined in file [F:\codestudy\nbcio-oa\test\ruoyi-nbcio-pro\ruoyi-admin\target\classes\com\ruoyi\web\controller\common\CaptchaController.class]: Unsatisfied dependency expressed through constructor parameter 2: Error creating bean with name 'sysConfigServiceImpl' defined in file [F:\codestudy\nbcio-oa\test\ruoyi-nbcio-pro\ruoyi-system\target\classes\com\ruoyi\system\service\impl\SysConfigServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'sysConfigMapper' defined in file [F:\codestudy\nbcio-oa\test\ruoyi-nbcio-pro\ruoyi-system\target\classes\com\ruoyi\system\mapper\SysConfigMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception with message: Failed to determine a suitable driver class
[31m2024-02-23 21:58:42[0;39m [32m[main][0;39m [1;31mERROR[0;39m [1;35mo.s.b.d.LoggingFailureAnalysisReporter
[0;39m - 
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
  If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
  If you have database settings to be loaded from a particular profile you may need to activate it (the profiles dev are currently active).

5、其中下面这个问题可以在根pom.xml里解决

Compile the affected code with '-parameters' instead or avoid its introspection: com.ruoyi.framework
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.9.0</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>com.github.therapi</groupId>
                            <artifactId>therapi-runtime-javadoc-scribe</artifactId>
                            <version>0.15.0</version>
                        </path>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                        <path>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-configuration-processor</artifactId>
                            <version>${spring-boot.version}</version>
                        </path>
                    </annotationProcessorPaths>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

主要是增加下面这个来解决

<compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>

6、数据源找不到的原因是ds必须要加一个boot3才能支持springboot3

<!-- dynamic-datasource 多数据源-->
            <dependency>
                <groupId>com.baomidou</groupId>
                <artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
                <version>${dynamic-ds.version}</version>
            </dependency>

7、修改完redis配置后出现下面错误

Description:
Failed to bind properties under 'spring.data.redis.ssl' to org.springframework.boot.autoconfigure.data.redis.RedisProperties$Ssl:
    Reason: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.Boolean] to type [org.springframework.boot.autoconfigure.data.redis.RedisProperties$Ssl]
Action:
Update your application's configuration


相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore &nbsp; &nbsp; ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库&nbsp;ECS 实例和一台目标数据库&nbsp;RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&amp;RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
相关文章
|
6月前
|
缓存 前端开发 Java
13:SpringBoot跨域解决方案-Java Spring
13:SpringBoot跨域解决方案-Java Spring
177 0
|
6月前
|
移动开发 前端开发 NoSQL
ruoyi-nbcio从spring2.7.18升级springboot到3.1.7,java从java8升级到17(二)
ruoyi-nbcio从spring2.7.18升级springboot到3.1.7,java从java8升级到17(二)
308 0
|
6月前
|
XML Java 应用服务中间件
3:SpringBoot-Java Spring
3:SpringBoot-Java Spring
43 0
|
Java 关系型数据库 数据库
Java 基于 SpringBoot 的书籍学习平台
Java 基于 SpringBoot 的书籍学习平台
Java SpringBoot集成WebSocket
Java SpringBoot集成WebSocket
|
Java API Spring
java202304java学习笔记第六十天-ssm-spring配置文件-spring相应api
java202304java学习笔记第六十天-ssm-spring配置文件-spring相应api
41 0
|
Java Spring
java202304java学习笔记第六十一天-ssm-spring配置文件-spring集成web环境
java202304java学习笔记第六十一天-ssm-spring配置文件-spring集成web环境
76 0
java202304java学习笔记第六十一天-ssm-spring配置文件-spring集成web环境
|
Java Apache 项目管理
Java|怎样快速搭建一个spring boot项目
Java|怎样快速搭建一个spring boot项目
181 0
|
Java Spring
java202304java学习笔记第六十天-ssm-spring配置文件-spring相应api2
java202304java学习笔记第六十天-ssm-spring配置文件-spring相应api2
66 0
|
负载均衡 Java 微服务
Java--SpringCloud-9-常用组件入门
什么是SpringCloud?
118 0
Java--SpringCloud-9-常用组件入门