Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring-cloud-openfeign自定义组件替换 #1

Merged
merged 4 commits into from
Jul 7, 2023
Merged

spring-cloud-openfeign自定义组件替换 #1

merged 4 commits into from
Jul 7, 2023

Conversation

Kurok1
Copy link
Contributor

@Kurok1 Kurok1 commented Jun 18, 2023

基于EnvironmentChangedEvent和feign.Capability实现部分feign组件自动刷新

目前支持组件替换列表

  • feign.RequestInterceptor
  • feign.Contract
  • feign.codec.Decoder
  • feign.codec.Encoder
  • feign.codec.ErrorDecoder
  • feign.QueryMapEncoder
  • feign.Retryer

核心类

io.microsphere.spring.cloud.openfeign.autorefresh.AutoRefreshCapability
在Target构建时替换组件
io.microsphere.spring.cloud.openfeign.omponents.DecoratedComponent
包装器实现,监听配置,完成组件替换
io.microsphere.spring.cloud.openfeign.omponents.CompositedRequestInterceptor
RequestIntercepter组合实现,监听配置,重组RequestIntercepter集合

使用

@io.microsphere.spring.cloud.openfeign.autoconfigure.EnableFeignAutoRefresh配置入口
在每个feign的定义,需要指定configuration,如:

@FeignClient(contextId = "aaa", name = "aaa", configuration = AutoRefreshCapability.class)

@mercyblitz mercyblitz merged commit ef82bba into microsphere-projects:main Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants