Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

A @FeignClient does not inherently create a circular dependency with WebMvcAutoConfiguration. In most cases, the cycle is introduced when an application-defined MVC component—such as a WebMvcConfigurer, formatter, converter, argument resolver, interceptor, or controller advice—eagerly injects or invokes a Feign client while Spring MVC infrastructure is still being created.

The Feign client is usually the participant that exposes the cycle, not the component that owns it. Find the MVC bean that reaches for the Feign proxy, then remove or defer that dependency.

What the error actually means

A startup trace may contain entries such as:

WebMvcAutoConfiguration$EnableWebMvcConfiguration
requestMappingHandlerMapping
mvcConversionService
FeignClientFactoryBean
BeanCurrentlyInCreationException

This does not prove that Spring Boot’s MVC auto-configuration is defective. WebMvcAutoConfiguration creates and contributes foundational MVC infrastructure, including handler mappings, conversion services, formatters, and related beans. If one of those beans cannot finish because an application dependency points back toward MVC infrastructure, Spring often reports the outer MVC bean where the failure became visible.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The most useful evidence is normally the deepest Caused by: section and the first bean belonging to your own application package.

How the dependency graph can loop

A representative cycle looks like this:

WebMvcAutoConfiguration
  -> requestMappingHandlerMapping
  -> mvcConversionService
  -> custom MVC bean
  -> Feign client proxy
  -> Feign client configuration
  -> Spring Web infrastructure
  -> WebMvcAutoConfiguration

This is a conceptual graph, not an invariant internal bean-creation sequence. The exact path depends on the Spring Boot and Spring Cloud versions, the client’s configuration, and the application beans involved.

What @FeignClient registers

@FeignClient is declarative metadata for a dynamically created client. With @EnableFeignClients, Spring Cloud OpenFeign registers the infrastructure needed to produce an injectable proxy rather than a hand-written implementation.

@FeignClient(name = "inventory-service")
public interface InventoryClient {

    @GetMapping("/inventory/{id}")
    InventoryDto find(@PathVariable Long id);
}

Depending on the configuration, startup may involve establishing the client’s name or contextId, client-specific configuration, encoders and decoders, the underlying HTTP client, load balancing, retry, observation, OAuth2, and circuit-breaker integrations. The implementation details and timing vary by release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Injecting the client into an ordinary service or controller is generally normal. The risk appears when the client is requested while foundational MVC beans are themselves being assembled. OpenFeign supports Spring MVC annotations and Spring Web infrastructure; that compatibility does not mean every lifecycle dependency between application MVC extensions and Feign is safe. See the Spring Cloud OpenFeign reference.

Common ways the cycle is introduced

1. Injecting Feign into a WebMvcConfigurer

This pattern can force the Feign proxy into existence during MVC configuration:

@Configuration
public class MvcConfiguration implements WebMvcConfigurer {

    private final RemoteMetadataClient client;

    public MvcConfiguration(RemoteMetadataClient client) {
        this.client = client;
    }

    @Override
    public void addFormatters(FormatterRegistry registry) {
        registry.addFormatter(new RemoteBackedFormatter(client));
    }
}

MVC is being assembled when the configuration is processed, while creating the client may require Spring Web-related infrastructure. That creates a path back to the MVC beans that have not completed.

Keep MVC configuration focused on local concerns whenever possible:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
@Configuration
public class MvcConfiguration implements WebMvcConfigurer {

    @Override
    public void addFormatters(FormatterRegistry registry) {
        registry.addFormatter(new LocalFormatter());
    }
}

If remote metadata is genuinely required, obtain it in a normal request or service operation rather than while constructing MVC infrastructure.

2. Feign-dependent converters, formatters, and argument resolvers

These beans are especially easy to overlook:

@Bean
public HandlerMethodArgumentResolver accountResolver(AccountClient client) {
    return new AccountResolver(client);
}

The resolver may not call the client in its constructor, but injecting the client into an MVC configuration path can still trigger premature creation. If deferred lookup is appropriate, use ObjectProvider:

@Bean
public HandlerMethodArgumentResolver accountResolver(
        ObjectProvider<AccountClient> clientProvider) {
    return new AccountResolver(clientProvider);
}

public final class AccountResolver implements HandlerMethodArgumentResolver {

    private final ObjectProvider<AccountClient> clients;

    public AccountResolver(ObjectProvider<AccountClient> clients) {
        this.clients = clients;
    }

    @Override
    public Object resolveArgument(
            MethodParameter parameter,
            ModelAndViewContainer container,
            NativeWebRequest request,
            WebDataBinderFactory binderFactory) {
        return clients.getObject().loadCurrentAccount();
    }
}

The OpenFeign documentation identifies ObjectProvider as a workaround for early-initialization problems. It defers lookup; it does not make a poor lifecycle dependency desirable. A request-time network call inside an argument resolver or formatter can still cause latency and availability problems.

3. A @Bean method that builds MVC infrastructure

Examples include a message converter configured from a remote schema, a conversion service populated from remote metadata, a validator initialized from a remote service, or a WebMvcConfigurer that loads tenant routes through Feign.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The practical rule is simple: MVC infrastructure must be buildable without making an outbound network client available. Avoid Feign calls in constructors, @Bean factory methods, and @PostConstruct methods.

4. Feign configuration included in component scanning

A per-client configuration class can accidentally become global application configuration when it is placed under the main component-scan package and annotated with @Configuration. That may cause its encoders, decoders, interceptors, or other beans to participate in the parent context unexpectedly.

Keep client-specific configuration isolated:

public class InventoryFeignConfiguration {

    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.BASIC;
    }
}
@FeignClient(
    name = "inventory-service",
    configuration = InventoryFeignConfiguration.class
)
public interface InventoryClient {
}

Inspect whether that configuration defines MVC-related beans or broad infrastructure that is being registered globally.

5. A distributed call cycle mistaken for a bean cycle

Not every cycle involving Feign is a Spring bean cycle:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Controller A
  -> Service A
  -> Feign Client B
  -> Remote Service B
  -> calls back into Service A

A bean cycle prevents the application context from starting. A service-call cycle may allow startup but cause recursive requests, latency amplification, or runtime outages. An initialization cycle occurs when a bean invokes another bean too early. A classpath failure can resemble a cycle while actually being a version or missing-class problem.

How Spring makes the problem visible

  1. Spring discovers configuration and component classes.
  2. MVC auto-configuration begins creating handler mappings and conversion infrastructure.
  3. An MVC-related bean requests an application dependency.
  4. That dependency is a Feign proxy.
  5. Feign-specific infrastructure begins initialization.
  6. A required dependency reaches back toward MVC infrastructure.
  7. Spring encounters a bean that is already being created.
  8. Startup fails with a circular-reference or BeanCurrentlyInCreationException-style error.

Do not assume that every Feign proxy or complete HTTP stack is eagerly initialized at exactly the same point. Bean timing differs across release trains and configurations.

A systematic debugging procedure

1. Confirm that it is really a circular dependency

Look at the deepest exception. Strong evidence includes:

BeanCurrentlyInCreationException
Requested bean is currently in creation

If the deepest cause is NoClassDefFoundError, ClassNotFoundException, NoSuchMethodError, or NoSuchBeanDefinitionException, investigate dependencies, scanning, and configuration before changing bean laziness.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A historical OpenFeign issue illustrates why a trace mentioning requestMappingHandlerMapping or mvcConversionService is not, by itself, proof of a literal Feign/MVC cycle.

2. Find the first application-owned bean

Search downward through the exception chain for the first class or bean under your project’s package. It may be named something like:

remoteFormatter
webMvcConfig
accountResolver
customHttpMessageConverter

That bean is often the edge that closes the graph.

3. Draw a short dependency graph

Rewrite the stack trace as dependencies rather than reading it as a flat list:

webMvcConfig
  -> remoteClient
  -> FeignClientFactoryBean
  -> decoder
  -> HttpMessageConverters
  -> requestMappingHandlerMapping
  -> webMvcConfig

The graph is more useful than the order in which nested exception messages appear.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Enable startup diagnostics

Enable the condition evaluation report:

debug=true

Then start the application with either:

./mvnw spring-boot:run

# or
java -jar app.jar --debug

For temporary bean-creation tracing:

logging.level.org.springframework.beans.factory=TRACE
logging.level.org.springframework.context=DEBUG
logging.level.org.springframework.cloud.openfeign=DEBUG

TRACE logging can be extremely large and may expose bean names or configuration details, so disable it after diagnosis.

5. Search for MVC and Feign coupling

Search your source for:

@EnableWebMvc
WebMvcConfigurer
WebMvcConfigurationSupport
addFormatters
addConverters
addArgumentResolvers
addInterceptors
HttpMessageConverter
@ControllerAdvice
@Bean
@FeignClient

@EnableWebMvc is not automatically the cause, but it changes how Boot’s MVC auto-configuration is applied and can make fragile customization harder to reason about.

6. Temporarily remove the MVC extension

Disable the suspected formatter, resolver, interceptor, advice, or configuration class. If the application starts, you have confirmed the dependency edge. Restore the component and remove its eager Feign dependency rather than disabling MVC auto-configuration wholesale.

7. Check the dependency graph

For Maven:

./mvnw dependency:tree 
  -Dincludes=org.springframework.boot,org.springframework.cloud,org.springframework

./mvnw dependency:tree 
  -Dverbose 
  -Dincludes=org.springframework.cloud:spring-cloud-openfeign-core

For Gradle:

./gradlew dependencies --configuration runtimeClasspath

./gradlew dependencyInsight 
  --dependency spring-cloud-openfeign 
  --configuration runtimeClasspath

Look for multiple Spring Boot or Spring Framework versions, a Spring Cloud release train not intended for the selected Boot version, duplicate HTTP-client libraries, or an old spring-cloud-openfeign-core pulled transitively.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the Spring Cloud BOM or the dependency-management mechanism recommended for your selected Spring Boot line. Do not mix arbitrary Boot, Spring Cloud, Spring Framework, and OpenFeign versions.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Fixes in preferred order

1. Remove Feign from MVC infrastructure

This is the best default. Keep formatters, converters, argument resolvers, and handler configuration local and deterministic. Move remote work into a service layer or explicit request operation.

This may require restructuring, but it creates a clean lifecycle boundary: MVC can start without depending on outbound service availability.

2. Defer lookup with ObjectProvider

Use this when the client is valid at request time but must not be created during startup:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
private final ObjectProvider<MyFeignClient> clientProvider;

public MyMvcComponent(ObjectProvider<MyFeignClient> clientProvider) {
    this.clientProvider = clientProvider;
}

Call getObject() only at the point where the request operation genuinely needs the client. Treat this as a deliberate lifecycle workaround, not proof that the dependency belongs in an MVC component.

3. Use @Lazy only tactically

public MyMvcComponent(@Lazy MyFeignClient client) {
    this.client = client;
}

@Lazy may help confirm that eager creation is the trigger, but it does not remove the architectural cycle. The application may fail later when the client is first used, and it does not fix dependency mismatches or distributed call cycles.

4. Isolate Feign configuration

Keep per-client encoders, decoders, interceptors, and logging settings out of broad component scanning. Check that client configuration does not accidentally define MVC beans or globally named infrastructure.

5. Correct dependency alignment

Prioritize this fix when the deepest exception is a missing class, missing method, or incompatible auto-configuration rather than BeanCurrentlyInCreationException. Confirm the exact compatibility matrix for your Boot and Spring Cloud release train. The current OpenFeign reference displays multiple stable release lines, including 5.0.2, 4.3.3, 4.2.3, and 4.1.5 as retrieved on September 15, 2026; those listings can change, so do not treat one version pair as universal.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

6. Consider another HTTP client model

The current Spring Cloud OpenFeign documentation describes OpenFeign as feature-complete and recommends considering Spring HTTP Service Clients for new development.

Spring HTTP Service Clients may be a good fit when you are creating new clients, do not need Feign-specific features, or want a Spring Framework-native declarative model. Retain OpenFeign when you already depend heavily on Feign clients, Spring Cloud LoadBalancer, established interceptors, fallback patterns, or tested shared configuration.

For more explicit lifecycle control, a manually configured RestClient is often suitable for synchronous servlet applications, while WebClient is better suited to reactive or non-blocking applications. Changing clients will not fix a cycle caused by an MVC component performing remote work during initialization.

Important edge cases

Servlet and WebFlux mixing

Accidentally including both servlet MVC and reactive WebFlux dependencies can expose confusing auto-configuration paths. Confirm whether the application is intended to be Servlet MVC, WebFlux, a gateway, or a test context with a different web application type.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test contexts

@WebMvcTest and other sliced contexts activate a different set of auto-configurations and may mock or omit Feign infrastructure. Use appropriate test replacements such as @MockBean where needed, but do not let a passing slice test conceal a production lifecycle dependency.

Multiple clients with the same service name

If multiple clients target the same service name, give them distinct contextId values:

@FeignClient(
    name = "catalog",
    contextId = "publicCatalogClient"
)
public interface PublicCatalogClient {
}

@FeignClient(
    name = "catalog",
    contextId = "adminCatalogClient"
)
public interface AdminCatalogClient {
}

This prevents client-context collisions; it does not directly solve an MVC circular dependency, but both problems can appear during the same startup investigation.

What not to do

  • Do not blindly set spring.main.allow-circular-references=true. It can hide a design problem and produce partially initialized beans. It also cannot fix distributed call cycles or incompatible dependencies.
  • Do not add @Lazy everywhere. Use it diagnostically or where deferred creation is genuinely correct.
  • Do not disable all MVC auto-configuration. Remove the application dependency edge instead.
  • Do not make network calls during startup. Constructors, @Bean methods, @PostConstruct, formatters, and argument-resolver construction should not depend on service readiness, DNS, credentials, or remote timeouts.
  • Do not assume the Feign annotation is defective. OpenFeign is designed to work with Spring MVC annotations; the issue is usually eager application-level coupling.

Diagnostic checklist

  • Is the deepest cause really BeanCurrentlyInCreationException?
  • What is the first application-owned bean in the trace?
  • Does a WebMvcConfigurer inject a Feign client?
  • Does a converter, formatter, resolver, interceptor, or advice use Feign?
  • Is a Feign call made in a constructor, @Bean, or @PostConstruct method?
  • Is Feign configuration accidentally component-scanned?
  • Are Spring Boot and Spring Cloud versions aligned?
  • Is the application mixing MVC and WebFlux?
  • Can the remote call move to a service or request boundary?
  • Is ObjectProvider being used as a deliberate workaround rather than to conceal a bad dependency?

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.