博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
spring cloud 启动报错-must be declared as an @AliasFor [serviceId], not [name].
阅读量:5320 次
发布时间:2019-06-14

本文共 5479 字,大约阅读时间需要 18 分钟。

项目加入FeignClient后再启动就报错,具体报错信息如下:

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:2118) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.core.annotation.AnnotationUtils$AliasDescriptor.from(AnnotationUtils.java:2057) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.core.annotation.AnnotationUtils.getAttributeAliasNames(AnnotationUtils.java:1726) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.core.annotation.AnnotationUtils.getAttributeAliasMap(AnnotationUtils.java:1639) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.core.annotation.AnnotationUtils.postProcessAnnotationAttributes(AnnotationUtils.java:1256) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.core.annotation.AnnotationUtils.postProcessAnnotationAttributes(AnnotationUtils.java:1217) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.core.type.classreading.AnnotationReadingVisitorUtils.convertClassValues(AnnotationReadingVisitorUtils.java:52) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.core.type.classreading.AnnotationMetadataReadingVisitor.getAnnotationAttributes(AnnotationMetadataReadingVisitor.java:134) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.core.type.classreading.AnnotationMetadataReadingVisitor.getAnnotationAttributes(AnnotationMetadataReadingVisitor.java:127) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.core.type.classreading.AnnotationMetadataReadingVisitor.getAnnotationAttributes(AnnotationMetadataReadingVisitor.java:49) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.cloud.netflix.feign.FeignClientsRegistrar.registerFeignClients(FeignClientsRegistrar.java:155) ~[spring-cloud-netflix-core-1.1.0.RELEASE.jar:1.1.0.RELEASE]    at org.springframework.cloud.netflix.feign.FeignClientsRegistrar.registerBeanDefinitions(FeignClientsRegistrar.java:87) ~[spring-cloud-netflix-core-1.1.0.RELEASE.jar:1.1.0.RELEASE]    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:359) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:143) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:270) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]    at clc.movie.MovieServiceApplication.main(MovieServiceApplication.java:44) [classes/:na]

检查了各种配置均没有发现问题,怀疑是版本不匹配的问题

我用的springboot 是1.5.6,springcloud是Brixton.RELEASE

这两个版本不兼容,导致了上面的错误

解决办法

是把Brixton.RELEASE 版本替换成 Dalston.SR5

 

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

spring boot spring cloud
Spring Boot 1.2.x Angel
Spring Boot 1.3.x Brixton
Spring Boot 1.4.x Camden
Spring Boot 1.5.x Dalston和Edgware
Spring Boot 2.0.x Finchley

 

转载于:https://www.cnblogs.com/chenglc/p/10070188.html

你可能感兴趣的文章
WPF中Image显示本地图片
查看>>
php仿阿里巴巴,php实现的仿阿里巴巴实现同类产品翻页
查看>>
面对问题,如何去分析?(日报问题)
查看>>
Java多线程基础(一)
查看>>
SQL Server中利用正则表达式替换字符串
查看>>
初始面向对象
查看>>
leetcode Letter Combinations of a Phone Number
查看>>
Unity 5.4 测试版本新特性---因吹丝停
查看>>
7.5 文件操作
查看>>
MyEclipse中将普通Java项目convert(转化)为Maven项目
查看>>
node js 安装.node-gyp/8.9.4 权限 无法访问
查看>>
windows基本命令
查看>>
VMware中CentOS设置静态IP
查看>>
[poj1006]Biorhythms
查看>>
Hyper-V虚拟机上安装一个图形界面的Linux系统
查看>>
Hover功能
查看>>
js千分位处理
查看>>
Mac---------三指拖移
查看>>
字符串类型的相互转换
查看>>
HTTP状态码
查看>>