In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Spring Cloud @ EnableFeignClients annotated attribute field basePacka is like, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
@ EnableFeignClients annotated property field basePacka
In general, we add the @ EnableFeignClients annotation to the startup class to indicate that there are places in the current application service (we call it service A) that want to reference interfaces in other application services (we call it service B).
If service B can be started separately and registered with the registry, we can simply add the @ EnableFeignClients annotation to the startup class of service A. if service B is not started separately, but is introduced into service An in the form of a Jar package, service A will not load the interface marked with @ FeignClient annotation in service B at startup and automatically generate the bean object.
In this way, we will report an error by introducing an interface marked with the @ FeignClient annotation in Service B in the Controller class in Service An as follows.
At this point, you need to use the basePackages property field to indicate that when application A starts, it needs to scan the package path of the interface annotated with @ FeignClient annotation in service B.
@ SpringBootApplication@EnableEurekaClient@EnableFeignClients (basePackages = {"com.bc.product.client"}) public class OrderApplication {public static void main (String [] args) {SpringApplication.run (OrderApplication.class, args);} basePackages questions about EnableFeignClients
If you use springcloud's openFeign, you need to add the @ EnableFeignClients annotation to the application.
Then spring ioc will not automatically generate bean objects for interface annotated with @ FeignClient in the jar package of other services introduced externally.
The right thing to do is to explicitly specify the value of basePackages, such as this:
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.