Skip to content

io microsphere spring cloud openfeign components DecoratedFeignComponent

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

DecoratedFeignComponent

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

Source: microsphere-spring-cloud-openfeign/src/main/java/io/microsphere/spring/cloud/openfeign/components/DecoratedFeignComponent.java

Overview

DecoratedFeignComponent is a class in the io.microsphere.spring.cloud.openfeign.components package of the microsphere-spring-cloud-openfeign module.

Declaration

public abstract class DecoratedFeignComponent<T> implements Refreshable

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

delegate

// Typically invoked via a subclass constructor
super(contextId, contextFactory, clientProperties, delegate);
T component = decoratedFeignComponent.delegate();

loadInstanceFromContextFactory

Decoder decoder = decoratedFeignComponent.loadInstanceFromContextFactory("my-client", Decoder.class);

contextId

String id = decoratedFeignComponent.contextId();

refresh

decoratedFeignComponent.refresh();

getDefaultConfiguration

Class<? extends T> type = decoratedFeignComponent.componentType();
FeignClientConfiguration defaultConfig = decoratedFeignComponent.getDefaultConfiguration();

getCurrentConfiguration

FeignClientConfiguration currentConfig = decoratedFeignComponent.getCurrentConfiguration();

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.components.DecoratedFeignComponent;

API Reference

Public Methods

Method Description
delegate Constructs a DecoratedFeignComponent wrapping the given delegate.
loadInstanceFromContextFactory Loads a component instance of the given type from the NamedContextFactory,
contextId Returns the Feign client context ID associated with this decorated component.
refresh Refreshes this component by clearing the delegate, causing the next call to
getDefaultConfiguration Returns the Feign component type class used to resolve the delegate implementation.
getCurrentConfiguration Returns the FeignClientConfiguration for the current Feign client context ID.

Method Details

delegate

public T delegate()

Constructs a DecoratedFeignComponent wrapping the given delegate.

Example Usage:

`// Typically invoked via a subclass constructor
super(contextId, contextFactory, clientProperties, delegate);
`

loadInstanceFromContextFactory

public <T> T loadInstanceFromContextFactory(String contextId, Class<T> componentType)

Loads a component instance of the given type from the NamedContextFactory, falling back to direct instantiation if the bean is not available.

Example Usage:

`Decoder decoder = decoratedFeignComponent.loadInstanceFromContextFactory("my-client", Decoder.class);
`

contextId

public String contextId()

Returns the Feign client context ID associated with this decorated component.

Example Usage:

`String id = decoratedFeignComponent.contextId();
`

refresh

public void refresh()

Refreshes this component by clearing the delegate, causing the next call to #delegate() to reload the instance from the context factory.

Example Usage:

`decoratedFeignComponent.refresh();
`

getDefaultConfiguration

public FeignClientConfiguration getDefaultConfiguration()

Returns the Feign component type class used to resolve the delegate implementation. Subclasses must implement this to return the appropriate configuration class.

Example Usage:

`Class type = decoratedFeignComponent.componentType();
`

getCurrentConfiguration

public FeignClientConfiguration getCurrentConfiguration()

Returns the FeignClientConfiguration for the current Feign client context ID.

Example Usage:

`FeignClientConfiguration currentConfig = decoratedFeignComponent.getCurrentConfiguration();
`

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

Home

spring-cloud-commons

spring-cloud-openfeign

Clone this wiki locally