spring-cloud-alibaba 2.1.0 适配 spring-boot 2.2

问题

spring-boot 2.2 搭配 spring-cloud-alibaba 2.1.0 时启动报错

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

org.springframework.cloud.client.discovery.health.DiscoveryCompositeHealthIndicator.<init>(DiscoveryCompositeHealthIndicator.java:42)

The following method did not exist:

org.springframework.boot.actuate.health.CompositeHealthIndicator.<init>(Lorg/springframework/boot/actuate/health/HealthAggregator;)V

The method's class, org.springframework.boot.actuate.health.CompositeHealthIndicator, is available from the following locations:

jar:file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-actuator/2.2.1.RELEASE/spring-boot-actuator-2.2.1.RELEASE.jar!/org/springframework/boot/actuate/health/CompositeHealthIndicator.class

It was loaded from the following location:

file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-actuator/2.2.1.RELEASE/spring-boot-actuator-2.2.1.RELEASE.jar

为什么版本不能搞成一致

在项目中使用Reactive 访问Elasticsearch时用到了 ReactiveElasticsearchRepository,但这个类是Spring-data-elasticsearch3.2才有的,需要搭配spring-boot2.2使用,并且微服务组件使用alibaba nacos目前只有2.1版本,因此会出现这样的问题

解决办法

spring-cloud-alibaba 目前只有2.1,但查询nacos依赖
nacos-config依赖
主要依赖context和commons,因此尝试将这两个依赖包排除,然后添加2.2版本的包
在这里插入图片描述
然后重启应用,发现已经可以正常工作,至此问题解决

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值