0. 环境
- nacos版本:1.4.1
- Spring Cloud : Hoxton.SR9(
没用2020.0.2版本后面说明) - Spring Boot :2.4.4
- Spring Cloud alibaba: 2.2.5.RELEASE
- Spring Cloud openFeign 2.2.2.RELEASE
2020.0.X版本开始的OpenFeign底层不再使用Ribbon了
1. 下载
github地址:github.com/spring-clou…

由于是maven工程,直接导入IDEA中就可以了
2. 核心类介绍
2.1 @EnableFeignClients
// @EnableFeignClients注解用来启动FeignClient,以支持Feign。
// 该注解可以通过配置,扫描指定位置的@FeignClient注解声明的Feign客户端接口
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Import(FeignClientsRegistrar.class)
public @interface EnableFeignClients {
// value和basePackage具有相同的功能,其中value是basePackage的别名
// value和basePackage只能同时使用一个
/**
* Alias for the {@link #basePackages()} attribute. Allows for more concise annotation
* declarations e.g.: {@code @ComponentScan("org.my.pkg")} instead of
* {@code @ComponentScan(basePackages="org.my.pkg")}.
* @return the array of 'basePackages'.
*/
// 为basePackages属性的别名,允许使用更简洁的书写方式。例如:@EnableFeignClients({"com.cd", "com.ad"})
String[] value() default {};
/**
* Base packages to scan for annotated components.
* <p>
* {@link #value()} is an alias for (and mutually exclusive with)

最低0.47元/天 解锁文章
957

被折叠的 条评论
为什么被折叠?



