JeecgBoot 升级springboot版本到2.6.0

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. 重新编译运行

 

 

问题未解决 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值