未找到接口类型为反应式的 bean。ReactiveFeignBuilder for "service"



我已经创建了一个简单的response Feign Client

@ReactiveFeignClient(name = "mechanic-service", path = "${mechanic.service.url}")
public interface MechanicClient {
@GetMapping("/mechanic-api/hello")
Mono<HelloWorldDetails> hi();
}

现在当我@Autowire它在我的服务类,IntelliJ给出一个错误:

无法自动连接。没有找到'MechanicClient'类型的bean。

这是我的主类:

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableReactiveFeignClients
public class CustomerApplication {
public static void main(String[] args) {
SpringApplication.run(CustomerApplication.class, args);
}
}

pom.xml

<properties>
<java.version>17</java.version>
<feign-reactor.version>3.1.1</feign-reactor.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>com.playtika.reactivefeign</groupId>
<artifactId>feign-reactor-spring-cloud-starter</artifactId>
<version>${feign-reactor.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

,当我启动服务器,我得到以下错误:

org.springframework.beans.factory.UnsatisfiedDependencyException:创建名称为"helloWorldController"的bean时出错:不满意通过字段'mechClient'表示的依赖性;嵌套异常是org.springframework.beans.factory.BeanCreationException:错误创建带有名称的bean"com.emech.customer.config.feign。MechanicClient': FactoryBean抛出对象创建异常;嵌套异常是java.lang.IllegalStateException:没有找到类型接口的beanreactivefeign。用于机械服务的ReactiveFeignBuilderorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor AutowiredFieldElement.resolveFieldValue美元(AutowiredAnnotationBeanPostProcessor.java: 660)~ (spring-beans-5.3.10.jar: 5.3.10]org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor AutowiredFieldElement.inject美元(AutowiredAnnotationBeanPostProcessor.java: 640)~ (spring-beans-5.3.10.jar: 5.3.10]org.springframework.beans.factory.annotation.InjectionMetadata.inject (InjectionMetadata.java: 119)~ (spring-beans-5.3.10.jar: 5.3.10]org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties (AutowiredAnnotationBeanPostProcessor.java: 399)~ (spring-beans-5.3.10.jar: 5.3.10]org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean (AbstractAutowireCapableBeanFactory.java: 1431)~ (spring-beans-5.3.10.jar: 5.3.10]org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java: 619)~ (spring-beans-5.3.10.jar: 5.3.10]org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java: 542)~ (spring-beans-5.3.10.jar: 5.3.10]org.springframework.beans.factory.support.AbstractBeanFactory.lambda doGetBean 0美元(AbstractBeanFactory.java: 335)~ (spring-beans-5.3.10.jar: 5.3.10]org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java: 234)~ (spring-beans-5.3.10.jar: 5.3.10]org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java: 333)~ (spring-beans-5.3.10.jar: 5.3.10]org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java: 208)~ (spring-beans-5.3.10.jar 5.3.10):

谁能指导我,我错过了什么,我是新的反应性伪造客户端。由于

您应该在@EnableReactiveFeignClients注释中指定客户端

@EnableReactiveFeignClients(clients = {MechanicClient.class})

相关内容

  • 没有找到相关文章