-
Notifications
You must be signed in to change notification settings - Fork 30
io microsphere spring cloud openfeign autorefresh FeignComponentRegistry
Type: Class | Module: microsphere-spring-cloud-openfeign | Package: io.microsphere.spring.cloud.openfeign.autorefresh | Since: 0.0.1
Feign Component Registry
public class FeignComponentRegistryAuthor: 韩超
-
Introduced in:
0.0.1 -
Current Project Version:
0.2.20-SNAPSHOT
This component is tested and compatible with the following Java versions:
| Java Version | Status |
|---|---|
| Java 17 | ✅ Compatible |
| Java 21 | ✅ Compatible |
| Java 25 | ✅ Compatible |
Class<?> componentClass = FeignComponentRegistry.getComponentClass("retryer");
// returns Retryer.classString normalized = FeignComponentRegistry.normalizeConfig("requestInterceptors[0]");
// returns "request-interceptors"FeignComponentRegistry registry = new FeignComponentRegistry("default", beanFactory);List<Refreshable> components = List.of(decoratedContract, decoratedDecoder);
registry.register("my-client", components);registry.register("my-client", decoratedContract);RequestInterceptor interceptor = template -> template.header("X-Custom", "value");
RequestInterceptor result = registry.registerRequestInterceptor("my-client", interceptor);registry.refresh("my-client", "retryer", "decoder");Set<String> changed = Set.of("my-client.retryer", "my-client.decoder");
registry.refresh("my-client", changed);Add the following dependency to your pom.xml:
<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-spring-cloud-openfeign</artifactId>
<version>${microsphere-spring-cloud.version}</version>
</dependency>Tip: Use the BOM (
microsphere-spring-cloud-dependencies) for consistent version management. See the Getting Started guide.
import io.microsphere.spring.cloud.openfeign.autorefresh.FeignComponentRegistry;| Method | Description |
|---|---|
register |
Returns the Feign component class corresponding to the given configuration key. |
register |
Registers a single Refreshable component for the specified Feign client. |
registerRequestInterceptor |
Registers a RequestInterceptor for the specified Feign client. Interceptors |
refresh |
Refreshes the Feign components for the specified client whose configurations have changed. |
refresh |
Refreshes the Feign components for the specified client based on a set of changed |
public void register(String clientName, List<Refreshable> components)Returns the Feign component class corresponding to the given configuration key.
Example Usage:
`Class componentClass = FeignComponentRegistry.getComponentClass("retryer");
// returns Retryer.class
`
public void register(String clientName, Refreshable component)Registers a single Refreshable component for the specified Feign client.
Example Usage:
`registry.register("my-client", decoratedContract);
`
public RequestInterceptor registerRequestInterceptor(String clientName, RequestInterceptor requestInterceptor)Registers a RequestInterceptor for the specified Feign client. Interceptors
are collected into a CompositedRequestInterceptor per client.
Example Usage:
`RequestInterceptor interceptor = template -> template.header("X-Custom", "value");
RequestInterceptor result = registry.registerRequestInterceptor("my-client", interceptor);
`
public void refresh(String clientName, String... changedConfigs)Refreshes the Feign components for the specified client whose configurations have changed.
Example Usage:
`registry.refresh("my-client", "retryer", "decoder");
`
public synchronized void refresh(String clientName, Set<String> changedConfigs)Refreshes the Feign components for the specified client based on a set of changed configuration keys. If the default client configuration changed, all registered components are refreshed.
Example Usage:
`Set changed = Set.of("my-client.retryer", "my-client.decoder");
registry.refresh("my-client", changed);
`
This documentation was auto-generated from the source code of microsphere-spring-cloud.
spring-cloud-commons
- AbstractServiceRegistrationEndpoint
- CommonsPropertyConstants
- ConditionalOnAutoServiceRegistrationAvailable
- ConditionalOnAutoServiceRegistrationEnabled
- ConditionalOnBlockingDiscoveryAvailable
- ConditionalOnFeaturesAvailable
- ConditionalOnFeaturesEnabled
- ConditionalOnLoadBalancerEnabled
- ConditionalOnMultipleRegistrationEnabled
- ConditionalOnReactiveDiscoveryAvailable
- ConditionalOnUtilEnabled
- ConfigurationPropertyHasFeaturesAutoConfiguration
- DefaultRegistration
- DiscoveryClientAutoConfiguration
- DiscoveryClientConstants
- DiscoveryUtils
- EventPublishingRegistrationAspect
- FaultTolerancePropertyConstants
- FeaturesConstants
- FeaturesProperties
- FeaturesUtils
- InMemoryServiceRegistry
- InstanceConstants
- LoadBalancerUtils
- MultipleAutoServiceRegistration
- MultipleRegistration
- MultipleServiceRegistry
- ReactiveDiscoveryClientAdapter
- ReactiveDiscoveryClientAutoConfiguration
- RegistrationCustomizer
- RegistrationDeregisteredEvent
- RegistrationEvent
- RegistrationMetaData
- RegistrationPreDeregisteredEvent
- RegistrationPreRegisteredEvent
- RegistrationRegisteredEvent
- ServiceDeregistrationEndpoint
- ServiceInstanceUtils
- ServiceInstancesChangedEvent
- ServiceRegistrationEndpoint
- ServiceRegistrationEndpointAutoConfiguration
- ServiceRegistryAutoConfiguration
- SimpleAutoServiceRegistration
- SimpleAutoServiceRegistrationAutoConfiguration
- SimpleServiceRegistry
- SpecificationAutoConfiguration
- SpecificationBeanPostProcessor
- SpecificationCustomizer
- SpringCloudPropertyConstants
- TomcatDynamicConfigurationListener
- TomcatFaultToleranceAutoConfiguration
- UnionDiscoveryClient
- WebFluxServiceRegistryAutoConfiguration
- WebMvcServiceRegistryAutoConfiguration
- WebServiceRegistryAutoConfiguration
- WeightedRoundRobin
spring-cloud-openfeign
- AutoRefreshCapability
- AutoRefreshCapabilityCustomizer
- CompositedRequestInterceptor
- DecoratedContract
- DecoratedDecoder
- DecoratedEncoder
- DecoratedErrorDecoder
- DecoratedFeignComponent
- DecoratedQueryMapEncoder
- DecoratedRetryer
- EnableFeignAutoRefresh
- FeignAutoConfiguration
- FeignClientAutoRefreshAutoConfiguration
- FeignClientConfigurationChangedListener
- FeignComponentRegistry
- NoOpRequestInterceptor
- Refreshable