In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you the relevant knowledge points about how to solve the failure of @ FeignClient injection service. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
@ FeignClient failed to inject service
Add comments above the entry class
@ EnableFeignClients (basePackages = {"com.ritoinfo.framework.evo.sp.sys.api", "com.yqjr.sp.eco.member"})
Due to the introduction of service jar packages using pom, if you do not add basePackage, you will not find the path where the package is located
Pit of Feign injection failure
Today I encountered a very bad problem: feign injection failed.
Error message
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
12-18 15 29V 57.654 ERROR [o.s.b.diagnostics.LoggingFailureAnalysisReporter]-
* *
APPLICATION FAILED TO START
* *
Description:
Field messageFeign in com.pance.scheduler.mdm.dataCenterTask.DataCenter required a bean of type 'com.pance.common.feign.MessageFeign' that could not be found.
The injection point has the following annotations:
-@ org.springframework.beans.factory.annotation.Autowired (required=true)
Action:
Consider defining a bean of type 'com.pance.common.feign.MessageFeign' in your configuration.
A very simple error message.
Look directly at Application and find and include the annotation @ EnableFeignClients, as well as @ ComponentScan ("com.pance"), and feign is also included in the com.pance directory.
I checked for a long time.
Finally, at the time of the most collapse, a detailed pit was found, which was introduced by feign in another common package. Although @ ComponentScan ("com.pance") specifies the scanning path that contains the path of feign, feign must add its own scanning range if it is not under the same module, for example
After @ EnableFeignClients (basePackages = "com.pance") is added, @ EnableFeignClients (basePackages = "com.pance") @ ComponentScan ("com.pance") @ EnableScheduling@SpringBootApplication (exclude = {DataSourceAutoConfiguration.class}) public class SchedulerApplication {public static void main (String [] args) {/ * only start one application*/ SpringApplication.run (SchedulerApplication.class, args);}}
If the jar package of Feign is under the same project as the service, you need to specify basePackage
These are all the contents of the article "how to solve the problem of @ FeignClient injecting service failure". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.