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

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

gitee源代码地址

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

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

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

gitee源代码地址

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

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

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

1、环境升级到java17

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

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

java 复制代码
<dependency>
	            <groupId>org.springframework.boot</groupId>
	            <artifactId>spring-boot-properties-migrator</artifactId>
	            <scope>runtime</scope>
            </dependency>

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

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

java 复制代码
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里解决

java 复制代码
Compile the affected code with '-parameters' instead or avoid its introspection: com.ruoyi.framework
java 复制代码
<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>

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

java 复制代码
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>

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

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

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

java 复制代码
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
相关推荐
XINGTECODE1 分钟前
海盗王集成网关和商城服务端功能golang版
开发语言·后端·golang
天天扭码7 分钟前
五天SpringCloud计划——DAY2之单体架构和微服务架构的选择和转换原则
java·spring cloud·微服务·架构
程序猿进阶7 分钟前
堆外内存泄露排查经历
java·jvm·后端·面试·性能优化·oom·内存泄露
FIN技术铺12 分钟前
Spring Boot框架Starter组件整理
java·spring boot·后端
zwjapple18 分钟前
typescript里面正则的使用
开发语言·javascript·正则表达式
小五Five19 分钟前
TypeScript项目中Axios的封装
开发语言·前端·javascript
小曲程序19 分钟前
vue3 封装request请求
java·前端·typescript·vue
前端每日三省21 分钟前
面试题-TS(八):什么是装饰器(decorators)?如何在 TypeScript 中使用它们?
开发语言·前端·javascript
凡人的AI工具箱34 分钟前
15分钟学 Go 第 60 天 :综合项目展示 - 构建微服务电商平台(完整示例25000字)
开发语言·后端·微服务·架构·golang
陈王卜36 分钟前
django+boostrap实现发布博客权限控制
java·前端·django