spring-cloud/spring-cloud-openfeign
Add defensive warning for multiple Feign Client beans
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
Incorrect Feign client configuration can result in multiple Client beans or non-singleton Client instances being created inside a Feign client context. This can potentially create multiple underlying HTTP connection pools and increase resource consumption.
Solution
Implementation Approach
Added a defensive warning in FeignClientFactoryBean to improve visibility when multiple Client beans are detected. Also updated the documentation to clarify that custom Feign Client beans should normally use singleton scope. The change improves detection of potentially expensive misconfiguration without changing existing bean lifecycle behaviour.
Technologies
Engineering Stack
Pull Request
View the Contribution
View the pull request and the associated engineering discussion directly on GitHub.
View Pull Request on GitHub →