-
Notifications
You must be signed in to change notification settings - Fork 30
io microsphere spring cloud openfeign components CompositedRequestInterceptor
Type: Class | Module: microsphere-spring-cloud-openfeign | Package: io.microsphere.spring.cloud.openfeign.components | Since: 0.0.1
CompositedRequestInterceptor is a class in the io.microsphere.spring.cloud.openfeign.components package of the microsphere-spring-cloud-openfeign module.
public class CompositedRequestInterceptor implements RequestInterceptor, RefreshableAuthor: 韩超
-
Introduced in:
0.0.1 -
Current Project Version:
0.2.18-SNAPSHOT
This component is tested and compatible with the following Java versions:
| Java Version | Status |
|---|---|
| Java 17 | ✅ Compatible |
| Java 21 | ✅ Compatible |
| Java 25 | ✅ Compatible |
CompositedRequestInterceptor interceptor =
new CompositedRequestInterceptor("my-client", beanFactory);Set<RequestInterceptor> interceptors = compositedInterceptor.getRequestInterceptors();RequestTemplate template = new RequestTemplate();
compositedInterceptor.apply(template);boolean wasFirst = compositedInterceptor.addRequestInterceptor(
template -> template.header("Authorization", "Bearer token"));compositedInterceptor.refresh();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.components.CompositedRequestInterceptor;| Method | Description |
|---|---|
getRequestInterceptors |
Constructs a CompositedRequestInterceptor for the specified Feign client context. |
apply |
Applies all registered RequestInterceptor instances to the given |
addRequestInterceptor |
Adds a RequestInterceptor to this composite. Returns true if this |
refresh |
Refreshes the set of RequestInterceptor instances by re-reading the |
public Set<RequestInterceptor> getRequestInterceptors()Constructs a CompositedRequestInterceptor for the specified Feign client context.
Example Usage:
`CompositedRequestInterceptor interceptor =
new CompositedRequestInterceptor("my-client", beanFactory);
`
public void apply(RequestTemplate template)Applies all registered RequestInterceptor instances to the given
RequestTemplate in order.
Example Usage:
`RequestTemplate template = new RequestTemplate(); compositedInterceptor.apply(template); `
public boolean addRequestInterceptor(RequestInterceptor requestInterceptor)Adds a RequestInterceptor to this composite. Returns true if this
is the first interceptor added (i.e., the composite was previously empty).
Example Usage:
`boolean wasFirst = compositedInterceptor.addRequestInterceptor(
template -> template.header("Authorization", "Bearer token"));
`
public void refresh()Refreshes the set of RequestInterceptor instances by re-reading the
FeignClientProperties configuration for request interceptors, default
headers, and default query parameters.
Example Usage:
`compositedInterceptor.refresh(); `
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
- 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