Skip to content

io microsphere spring cloud openfeign autorefresh AutoRefreshCapability

github-actions[bot] edited this page Jun 10, 2026 · 5 revisions

AutoRefreshCapability

Type: Class | Module: microsphere-spring-cloud-openfeign | Package: io.microsphere.spring.cloud.openfeign.autorefresh | Since: 0.0.1

Source: microsphere-spring-cloud-openfeign/src/main/java/io/microsphere/spring/cloud/openfeign/autorefresh/AutoRefreshCapability.java

Overview

AutoRefreshCapability is a class in the io.microsphere.spring.cloud.openfeign.autorefresh package of the microsphere-spring-cloud-openfeign module.

Declaration

public class AutoRefreshCapability implements Capability, ApplicationContextAware

Author: 韩超

Version Information

  • Introduced in: 0.0.1
  • Current Project Version: 0.2.18-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

Method Examples

setApplicationContext

AutoRefreshCapability capability = new AutoRefreshCapability(
    clientProperties, contextFactory, componentRegistry);
AutoRefreshCapability capability = new AutoRefreshCapability(props, factory, registry);
capability.setApplicationContext(applicationContext);

enrich

Retryer original = new Retryer.Default();
Retryer enriched = capability.enrich(original);

enrich

Contract original = new Contract.Default();
Contract enriched = capability.enrich(original);

enrich

Decoder original = new Decoder.Default();
Decoder enriched = capability.enrich(original);

enrich

Encoder original = new Encoder.Default();
Encoder enriched = capability.enrich(original);

enrich

ErrorDecoder original = new ErrorDecoder.Default();
ErrorDecoder enriched = capability.enrich(original);

enrich

RequestInterceptor original = template -> template.header("X-Custom", "value");
RequestInterceptor enriched = capability.enrich(original);

enrich

QueryMapEncoder original = new QueryMapEncoder.Default();
QueryMapEncoder enriched = capability.enrich(original);

Usage

Maven Dependency

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

import io.microsphere.spring.cloud.openfeign.autorefresh.AutoRefreshCapability;

API Reference

Public Methods

Method Description
setApplicationContext Constructs an AutoRefreshCapability with the required dependencies.
enrich Enriches the given Retryer by wrapping it in a DecoratedRetryer
enrich Enriches the given Contract by wrapping it in a DecoratedContract
enrich Enriches the given Decoder by wrapping it in a DecoratedDecoder
enrich Enriches the given Encoder by wrapping it in a DecoratedEncoder
enrich Enriches the given ErrorDecoder by wrapping it in a DecoratedErrorDecoder
enrich Enriches the given RequestInterceptor by registering it in the
enrich Enriches the given QueryMapEncoder by wrapping it in a DecoratedQueryMapEncoder

Method Details

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)

Constructs an AutoRefreshCapability with the required dependencies.

Example Usage:

`AutoRefreshCapability capability = new AutoRefreshCapability(
    clientProperties, contextFactory, componentRegistry);
`

enrich

public Retryer enrich(Retryer retryer)

Enriches the given Retryer by wrapping it in a DecoratedRetryer that supports auto-refresh on configuration changes.

Example Usage:

`Retryer original = new Retryer.Default();
Retryer enriched = capability.enrich(original);
`

enrich

public Contract enrich(Contract contract)

Enriches the given Contract by wrapping it in a DecoratedContract that supports auto-refresh on configuration changes.

Example Usage:

`Contract original = new Contract.Default();
Contract enriched = capability.enrich(original);
`

enrich

public Decoder enrich(Decoder decoder)

Enriches the given Decoder by wrapping it in a DecoratedDecoder that supports auto-refresh on configuration changes.

Example Usage:

`Decoder original = new Decoder.Default();
Decoder enriched = capability.enrich(original);
`

enrich

public Encoder enrich(Encoder encoder)

Enriches the given Encoder by wrapping it in a DecoratedEncoder that supports auto-refresh on configuration changes.

Example Usage:

`Encoder original = new Encoder.Default();
Encoder enriched = capability.enrich(original);
`

enrich

public ErrorDecoder enrich(ErrorDecoder decoder)

Enriches the given ErrorDecoder by wrapping it in a DecoratedErrorDecoder that supports auto-refresh on configuration changes.

Example Usage:

`ErrorDecoder original = new ErrorDecoder.Default();
ErrorDecoder enriched = capability.enrich(original);
`

enrich

public RequestInterceptor enrich(RequestInterceptor requestInterceptor)

Enriches the given RequestInterceptor by registering it in the FeignComponentRegistry as part of a io.microsphere.spring.cloud.openfeign.components.CompositedRequestInterceptor.

Example Usage:

`RequestInterceptor original = template -> template.header("X-Custom", "value");
RequestInterceptor enriched = capability.enrich(original);
`

enrich

public QueryMapEncoder enrich(QueryMapEncoder queryMapEncoder)

Enriches the given QueryMapEncoder by wrapping it in a DecoratedQueryMapEncoder that supports auto-refresh on configuration changes.

Example Usage:

`QueryMapEncoder original = new QueryMapEncoder.Default();
QueryMapEncoder enriched = capability.enrich(original);
`

This documentation was auto-generated from the source code of microsphere-spring-cloud.

Home

spring-cloud-commons

spring-cloud-openfeign

Clone this wiki locally