spring-cloud/spring-cloud-openfeign

Add defensive warning for multiple Feign Client beans to avoid potential resource exhaustion

PerformanceMarch 26, 2026Open

Contribution Overview

The Engineering Context

This contribution was made to the spring-cloud/spring-cloud-openfeignopen-source repository. The work involved understanding the existing codebase, identifying the underlying engineering problem, implementing a focused solution, and validating the change against the project's existing behaviour and testing standards.

Engineering Problem

Understanding the Problem

A misconfigured Feign client context could define multiple or non-singleton Client beans. This can result in multiple underlying HTTP connection pools being created and potentially increase resource consumption or lead to resource exhaustion.

Solution

Implementation Approach

Added defensive detection and warning behaviour around multiple Client beans in the Feign client context without changing the existing bean lifecycle or creation semantics. Also updated the documentation to clarify that custom Client beans should normally be singleton-scoped.

Technologies

Engineering Stack

JavaSpring BootSpring Cloud OpenFeignOpenFeignSpring FrameworkHTTP Clients

Pull Request

View the Contribution

View the pull request and the associated engineering discussion directly on GitHub.

View Pull Request on GitHub →