SpringCloudOpenFeign源码深度解析
2022-11-01 13:48:30 2 举报
AI智能生成
有钱给点儿,没钱拉倒
作者其他创作
大纲/内容
Spring Cloud Open Feign深度解析
genericBeanDefinition(FeignClientSpecification.class)
registerClientConfiguration
getAnnotationAttributes(EnableFeignClients.class.getName())
if
this.getScanner()
scanner.addIncludeFilter(new AnnotationTypeFilter(FeignClient.class))
this.getBasePackages(metadata)
scanner.findCandidateComponents(basePackage)
关系图
new FeignClientFactoryBean()
FeignContext
okhttp3.OkHttpClient
Client
OkHttpFeignConfiguration
FeignAutoConfiguration
beanFactory.getBean(FeignContext.class) :
Contract
Level
Logger
builder = this.feign(context)
BlockingLoadBalancerClientAutoConfiguration
new FeignBlockingLoadBalancerClient
HttpClientFeignLoadBalancerConfiguration
FeignContext.getBean(Client.class)
builder.client(client)
new DefaultTargeter()
FeignAutoConfiguration.DefaultFeignTargeterConfiguration
this.processAnnotationsOnParameter
SpringMvcContract#parseAndValidateMetadata
contract.parseAndValidateMetadata
feign.ReflectiveFeign.ParseHandlersByName#apply
Proxy.newProxyInstance
newInstance
new ReflectiveFeign
Feign.builder()
Builder.target
DefaultTargeter.target
this.loadBalance
getTarget()
return factoryBean.getObject()
else
span style=\"font-size: inherit;\
registerBeanDefinitions
@Import({FeignClientsRegistrar.class})
@EnableFeignClients
启动流程
resolved.uri(uri.toString())
resolved.headers(Collections.emptyMap())
this.buildTemplateFromArgs.create(argv);
this.findOptions(argv);
this.targetRequest(template);
this.logger.logRequest
重写chose方法
BlockingLoadBalancerClient implements LoadBalancerClient
扩展点
this.promoteAndExecute();
this.client.dispatcher().finished(this)
requestScoped.newCall(request).execute()
executeWithLoadBalancerLifecycleProcessing
URI.create(request.url());
FeignBlockingLoadBalancerClient#execute
SynchronousMethodHandler#invoke
ReflectiveFeign#invoke
调用流程
0 条评论
回复 删除
下一页