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
相关推荐
Antonio9151 分钟前
【CMake】使用CMake在Visual Studio内构建多文件夹工程
开发语言·c++·visual studio
骆晨学长13 分钟前
基于springboot的智慧社区微信小程序
java·数据库·spring boot·后端·微信小程序·小程序
LyaJpunov15 分钟前
C++中move和forword的区别
开发语言·c++
AskHarries18 分钟前
利用反射实现动态代理
java·后端·reflect
@月落18 分钟前
alibaba获得店铺的所有商品 API接口
java·大数据·数据库·人工智能·学习
程序猿练习生19 分钟前
C++速通LeetCode中等第9题-合并区间
开发语言·c++·leetcode
bjzhang7520 分钟前
SpringBoot开发——整合SpringDoc实现在线接口文档
spring boot·springdoc
liuyang-neu24 分钟前
力扣 42.接雨水
java·算法·leetcode
z千鑫28 分钟前
【人工智能】如何利用AI轻松将java,c++等代码转换为Python语言?程序员必读
java·c++·人工智能·gpt·agent·ai编程·ai工具
一名路过的小码农29 分钟前
C/C++动态库函数导出 windows
c语言·开发语言·c++