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

本文涉及的产品
云数据库 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
相关文章
|
21天前
|
移动开发 前端开发 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(二)
152 0
|
21天前
|
XML Java 应用服务中间件
3:SpringBoot-Java Spring
3:SpringBoot-Java Spring
24 0
|
9月前
|
Java 关系型数据库 数据库
Java 基于 SpringBoot 的书籍学习平台
Java 基于 SpringBoot 的书籍学习平台
|
12月前
|
Java Apache 项目管理
Java|怎样快速搭建一个spring boot项目
Java|怎样快速搭建一个spring boot项目
153 0
|
存储 Oracle Java
SpringBoot - 探究Spring Boot应用是如何通过java -jar 启动的
SpringBoot - 探究Spring Boot应用是如何通过java -jar 启动的
325 0
|
前端开发 Java 应用服务中间件
Java 学习之入门springBoot
# 简介 SpringBoot是Pivotal团队提供的全新框架,其设计目的来简化Spring应用的初始搭建以及开发过程。 ## 对比之前的框架 笔者之前也学习应用过很多框架,包括Spring,SpringMVC,MyBatis等等....... 拿SpringMVC来举例,在SpingMVC中配置了处理请求的时候,会遇到静态资源无法访问的问题,这是因为我们对于getSeverletMappings中的设置是控制所有的路由,那么这问题就来了,我们对于访问静态资源这个事情,并不会经手Tomcat,而是经过SpringMVC,他会直接拦截我们的请求,而拦截后springMVC会发现我们并没
|
Java Maven
Java:启动SpringBoot应用的方式汇总
Java:启动SpringBoot应用的方式汇总
88 0
|
Java Maven
Java中springboot项目怎么远程调试
maven打包成jar的时候 执行命令行开启远程调试
83 0
Java中springboot项目怎么远程调试
|
负载均衡 Java 微服务
|
Java API
Java--SpringBoot-19-SpringBoot集成Swagger
在开发接口完后,我们都要编写接口规范文档,今天整一个能自动生成接口规范文档,并且能在开发的时候顺带的就能把文档更新的东西,她就是Swagger!
85 0
Java--SpringBoot-19-SpringBoot集成Swagger

热门文章

最新文章