1. 环境描述
Jeecgboot 3.0,他所依赖的springboot版本为2.3.5Release,将springboot版本升级为2.6.0。过程全纪录,从2开始描述。
2. 修改springboot版本号
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.0</version>
<relativePath/>
</parent>
修改后,自动导入,导入完成后,运行后端,提示的错误信息有。
3. JeecgRedisCacheWriter错误
根据提示,重新复写3个方法,用默认的。
@Override
public CacheStatistics getCacheStatistics(String cacheName) {
return null;
}
@Override
public void clearStatistics(String name) {
}
@Override
public RedisCacheWriter withStatisticsCollector(CacheStatisticsCollector cacheStatisticsCollector) {
return null;
}
4. RedisUtil错误
@SuppressWarnings("unchecked")
public void del(String... key) {
if (key != null && key.length > 0) {
if (key.length == 1) {
redisTemplate.delete(key[0]);
} else {
redisTemplate.delete(CollectionUtils.arrayToList(key));
}
}
}
将最后一条语句加上显示转换
redisTemplate.delete((Collection<String>) CollectionUtils.arrayToList(key));
另外一个错误是
通过点进去看源码,将改行代码调整为
Cursor<byte[]> cursor = connection.scan(ScanOptions.scanOptions().match(realKey).count(Integer.MAX_VALUE).build());
4. 重新编译运行
错误提示如下图:
在jeecg-boot-system-module模块的pom.xml文件中,增加了坐标,错误消失
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
5. 重新编译运行
提示循环依赖
对于这个问题,采用提示的解决方案
As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.
在application.yml文件中修改配置项
spring:
application:
name: jeecg-system
profiles:
active: @profile.name@
main:
allow-circular-references: true
6.重新编译运行
提示错误如下图
百度这个问题,最后找到解决方案,将application-dev.yml文件中的配置修改下,修改的是深色标注的部分
修改后的内容为
quartz:
job-store-type: jdbc
initialize-schema: embedded
#定时任务启动开关,true-开 false-关
auto-startup: true
#启动时更新己存在的Job
overwrite-existing-jobs: true
properties:
org:
quartz:
scheduler:
instanceName: MyScheduler
instanceId: AUTO
jobStore:
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
tablePrefix: QRTZ_
isClustered: true
misfireThreshold: 60000
clusterCheckinInterval: 10000
7. 重新编译运行
提示错误
跟踪代码发现,是3中的 getCacheStatistics返回空所致。
在JeecgRedisCacheWriter类中增加如下代码
private final CacheStatisticsCollector statistics = CacheStatisticsCollector.create();
@Override
public CacheStatistics getCacheStatistics(String cacheName) {
return statistics.getCacheStatistics(cacheName);
}
8. 重新编译运行
问题未解决