在使用springboot微服务的@FeignClient注解时报一下的错
16:31:30.788 [main] INFO org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration - [initialize,98] - Located property source: CompositePropertySource {name='consul', propertySources=[ConsulPropertySource {name='config/sdb-journal-data-service/'}, ConsulPropertySource {name='config/application/'}]}
16:31:30.804 [main] WARN org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration - [reinitializeLoggingSystem,137] - Logging config file location 'classpath:logback-spring.xml' cannot be opened and will be ignored
16:31:30.810 [main] INFO cn.sciencedb.JournalApplication - [logStartupProfileInfo,675] - No active profile set, falling back to default profiles: default
16:31:31.771 [main] ERROR org.springframework.boot.SpringApplication - [reportFailure,858] - Application run failed
java.lang.IllegalArgumentException: Fallback class must implement the interface annotated by @FeignClient
at org.springframework.util.Assert.isTrue(Assert.java:118)
at org.springframework.cloud.openfeign.FeignClientsRegistrar.validateFallback(FeignClientsRegistrar.java:206)
at org.springframework.cloud.openfeign.FeignClientsRegistrar.validate(FeignClientsRegistrar.java:201)
at org.springframework.cloud.openfeign.FeignClientsRegistrar.registerFeignClient(FeignClientsRegistrar.java:169)
at org.springframework.cloud.openfeign.FeignClientsRegistrar.registerFeignClients(FeignClientsRegistrar.java:158)
at org.springframework.cloud.openfeign.FeignClientsRegistrar.registerBeanDefinitions(FeignClientsRegistrar.java:83)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$1(ConfigurationClassBeanDefinitionReader.java:364)
at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:363)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:145)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:327)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:691)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at cn.sciencedb.JournalApplication.main(JournalApplication.java:20)
Disconnected from the target VM, address: '127.0.0.1:52483', transport: 'socket'
解决方法
是因为
红框中必须为实现类的 .class 文件