spring cloud 微服务启动报错终极解决方案

今天在开发一个spring cloud 的微服务的时候,启动报如下错误

org.springframework.core.annotation.AnnotationConfigurationException: Attribute 'value' in annotation [org.springframework.cloud.netflix.feign.FeignClient] must be declared as an @AliasFor [serviceId], not [name].
	at org.springframework.core.annotation.AnnotationUtils$AliasDescriptor.validate(AnnotationUtils.java:2154) ~[spring-core-4.3.17.RELEASE.jar:4.3.17.RELEASE]
	at org.springframework.core.annotation.AnnotationUtils$AliasDescriptor.from(AnnotationUtils.java:2093) ~[spring-core-4.3.17.RELEASE.jar:4.3.17.RELEASE]
	at org.springframework.core.annotation.AnnotationUtils.getAttributeAliasNames(AnnotationUtils.java:1748) ~[spring-core-4.3.17.RELEASE.jar:4.3.17.RELEASE]
	at org.springframework.core.annotation.AnnotationUtils.getAttributeAliasMap(AnnotationUtils.java:1661) ~[spring-core-4.3.17.RELEASE.jar:4.3.17.RELE

然后检查了各种配置均没有发现问题,最终怀疑到依赖版本上,经过一番文档的搜索,最后发现确实是版本问题

我用的spring boot 1.5.3 realease,spring cloud版本用的是 Brixton.RELEASE,这两个版本不兼容,导致了上面的错误

解决办法是把Brixton.RELEASE 版本替换成 Dalston.SR5

替换完后,重新运行,问题就解决了!

spring boot 跟 spring cloud的版本对应关系如下

spring bootspring cloud
Spring Boot 1.2.xAngel
Spring Boot 1.3.xBrixton
Spring Boot 1.4.xCamden
Spring Boot 1.5.xDalston和Edgware
Spring Boot 2.0.xFinchley
  
  
  
  

原创博文,转发请标明出处,谢谢!

来自EDSE的创作





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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值