Feign装载初始化流程
2021-05-13 18:33:55 0 举报
Spring cloud 中Feign的注解,factory和装载流程
作者其他创作
大纲/内容
DefaultTargeter
FeignClientSpecification
NamedContextFactory
configureUsingConfiguration(context)
ConnectionPool
HystrixTargeter(feign.hystrix.HystrixFeign WithClass)
HystrixTargeter
FeignAutoConfiguration
Client(wrapper)
CloseableHttpClient
Retryer
OkHttpFeignConfiguration(feign.okhttp.enabled开关)
Targeter
解析注解(EnableFeignClients)上的信息1 扫描包,找出报下的有FeignClient注解的class2 循环获取每个Client注解上的信息3 为每个serviceName注入自定义(默认的)configuration4 为每个Client创建一个ClientFactoryBean,并registe
HardCodedTarget
FormattingConversionService
FeignClientsRegistrar
1 logger2 retryer3 errorDecoder4 options5 requestInterceptors6 decode4047 connectTimeout8 encoder9 decoder10 contract
Feign.Builder
configureUsingProperties(DefaultConfig)
FeignContext
(Http)Client
1 logger2 retryer3 errorDecoder4 options5 requestInterceptors6 decode404
HttpClientFeignConfiguration(feign.httpclient.enabled开关)
HttpClientConnectionManager
HystrixFeign.Builder
HystrixFeignConfiguration(feign.hystrix.enabled开启)
FeignClientFactoryBean
Encoder
DefaultTargeter
Decoder
OkHttpClient
Builder
configureUsingProperties(contextId,Config)
通过调用getObject创建Client代理对象
1 logger2 Encoder3 Decoder4 Contract
configureFeign()
Name处理(url,path类似)1 优先获取serviceId2 再获取name3 其次value4 根据获取到的名字再resolve5 根据this.environment.resolvePlaceholders
List<FeignClientSpecification>
feign()
FeignClientsConfiguration
Contract
EnableFeignClients
解析注解(EnableFeignClients)上的信息1 初始化默认configuration并register2 创建clientFactoryBean并registe
1 确定HttpClient,span style=\"font-size: inherit;\
0 条评论
下一页