宋子宪博客

Szx

java.lang.IllegalStateException: Either 'name' or 'value' must be provided in @FeignClient解决方法
java.lang.IllegalStateException: Either 'name' or 'value'...
扫描右侧二维码阅读全文
08
2019/10

java.lang.IllegalStateException: Either 'name' or 'value' must be provided in @FeignClient解决方法

java.lang.IllegalStateException: Either 'name' or 'value' must be provided in @FeignClient
    at org.springframework.cloud.openfeign.FeignClientsRegistrar.getClientName(FeignClientsRegistrar.java:346)
    at org.springframework.cloud.openfeign.FeignClientsRegistrar.registerFeignClients(FeignClientsRegistrar.java:154)
    at org.springframework.cloud.openfeign.FeignClientsRegistrar.registerBeanDefinitions(FeignClientsRegistrar.java:83)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$1(ConfigurationClassBeanDefinitionReader.java:357)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$$Lambda$152/1314838582.accept(Unknown Source)
    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:676)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:356)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:144)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:328)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
    at com.songzixian.AppPortalWeb.main(AppPortalWeb.java:19)
4598 INFO  [2019-10-08 01:47:47]  Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@22356acd: startup date [Tue Oct 08 01:47:47 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@4988d8b8
4598 DEBUG [2019-10-08 01:47:47]  Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@16414e40: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,appPortalWeb,org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory,verifyController,loginController,QQAuthoriController,registerController,indexController,baseApiService,globalExceptionHandler,generateToken,redisDataSoureceTransaction,redistUtil,org.springframework.boot.autoconfigure.AutoConfigurationPackages,default.com.songzixian.AppPortalWeb.FeignClientSpecification,app-songzixian-member.FeignClientSpecification,com.songzixian.member.feign.MemberLoginServiceFeign,com.songzixian.member.feign.MemberRegisterServiceFeign,com.songzixian.member.feign.MemberServiceFeign]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@52af26ee
4598 DEBUG [2019-10-08 01:47:47]  Retrieved dependent beans for bean 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory': [org.springframework.context.annotation.internalConfigurationAnnotationProcessor]

Process finished with exit code 1

出现这个问题原因是因为没有再@FeignClient客户端没有写上服务器名称,填写被调用者服务名称即可

Last modification:October 8th, 2019 at 01:53 am
如果觉得这篇技术文章对您有帮助,可以请博主喝一杯饮料

Leave a Comment