Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that Feign import dependency is unknow in springcloud

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to solve the problem of Feign import dependence as unknow in springcloud". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Cases where the Feign import dependency is unknow

Many people on the Internet rely on feign in pom.xml when using pom.xml:

Org.springframework.cloud spring-cloud-starter-feign

But in my personal use process has not been successful, Maven DeDependencies has been shown as:

Spring-cloud-starter-feign:unknow

After flipping through the official documents, I found this sentence:

To include Feign in your project use the starter with group org.springframework.cloud and artifact id spring-cloud-starter-openfeign. See the Spring Cloud Project page for details on setting up your build system with the current Spring Cloud Release Train.

Handling of failed import of org.springframework.cloud spring-cloud-starter-openfeignFeign comments

When learning SpringCloud (Finchley.M8) Feign, you can never import these two annotations @ EnableFeignClients,@FeignClient. In fact, pom.xml has already imported the dependency spring-cloud-starter-openfeign, and the version of SpringBoot is 2.0.0.RELEASE.

It is suspected that some of the dependent jar package downloads are incomplete. Because you are not sure which jar packages are or which are incomplete, you need to update all failed jar packages in the project in bulk.

Open the command line and run the following command, which forces maven to update the unfinished jar package

Cd {project_home} mvn clean install-U

Sure enough, I saw abnormal output.

[ERROR] error reading {maven_home}\ org\ springframework\ cloud\ spring-cloud-openfeign-core\ 2.0.0.M1\ spring-cloud-openfeign-core-2.0.0.M1.jar; invalid LOC header (bad signature)

Delete this file spring-cloud-openfeign-core-2.0.0.M1.jar manually

Re-execute the above maven command to force the update of the jar package and throw the exception again:

SchedualServiceHi referenced in HiController, automatic injection failed.

In order to compile and pass, @ FeignClient has been annotated previously, and of course it can't be injected automatically.

Comment the relevant code of Controller, and execute the maven command for the third time to force the update of the jar package. Success.

With the maven command, after updating the jar package successfully, press Ctrl + Shif + O, and you can import the relevant comments of Feign normally.

This is the end of the content of "how to solve the problem of Feign import dependency as unknow in springcloud". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report