我有这个pom:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
<version>1.4.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
当我运行mvn dependency:tree | findstr feign
时,我会得到
[INFO] +- org.springframework.cloud:spring-cloud-starter-feign:jar:1.4.6.RELEASE:compile
[INFO] | \- org.springframework.cloud:spring-cloud-starter-openfeign:jar:1.4.6.RELEASE:compile
[INFO] | +- io.github.openfeign:feign-core:jar:9.5.0:compile
[INFO] | +- io.github.openfeign:feign-slf4j:jar:9.5.0:compile
[INFO] | \- io.github.openfeign:feign-hystrix:jar:9.5.0:compile
但是即使我尝试将import org.springframework.cloud.openfeign.FeignClient;
用作here,我也注意到Eclipse / mvn clean package -U
仍然无法识别我的依赖关系。
我缺少什么可能的配置?
答案 0 :(得分:0)
我认为您使用的是无效的云版本。以下是示例工作pom代码段。也许这会对您有所帮助。
您可以从此链接找到工作pom。我在这里将Feign与Ribbon结合使用。 https://github.com/ROBINSINGH0210/microservice-currency-service-spring-boot/blob/master/pom.xml
<properties>
<spring-cloud.version>Finchley.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>