关于spring cloud中Feign导入jar失败问题

网上很多人在使用的feign时在pom.xml中填写的是:

	<dependency> 
      <groupId>org.springframework.cloud</groupId> 
      <artifactId>spring-cloud-starter-feign</artifactId> 
    </dependency>

但是在我个人的使用过程中没能成功,像上面填好后一直报错,说没有指定版本,后来我有百度看是怎么回事:

	<dependency> 
      <groupId>org.springframework.cloud</groupId> 
      <artifactId>spring-cloud-starter-feign</artifactId> 
      <version>1.3.1.RELEASE</version> 
    </dependency>

变成这个有版本号的了,以为成功了,准备写@FeignClient发现没有这个标签,这下把我玩够了,又在百度上找问题所在。

有的说是可能没有下载完成导致的需要重新导入,搞了好久都没有解决。最后我尝试了最笨的方法,修改版本号看行不行,结果行了,把我玩够了。下面这个在pom.xml 中导入就么有问题。

	<dependency> 
      <groupId>org.springframework.cloud</groupId> 
      <artifactId>spring-cloud-starter-feign</artifactId> 
      <version>1.4.1.RELEASE</version> 
    </dependency>

经过自己在学习中发现用一下的方式也能够完美导入feign:

                <dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-openfeign</artifactId>
		</dependency>

最后分析了一下可能是因为feign的版本更新太快导致的吧。

猜你喜欢

转载自blog.csdn.net/qq_33868430/article/details/81391053