Fix unconditional overwrite of resolved fallbackFactory in FeignClientsRegistrar#1378
Merged
ryanjbaxter merged 1 commit intoMay 27, 2026
Conversation
Contributor
|
Can you please sign your commit so the DCO passes? Could you submit the PR against the 4.3.x branch? |
eagerlyRegisterFeignClientBeanDefinition resolves the fallbackFactory attribute via ClassUtils.resolveClassName when it is provided as a String, but then unconditionally re-sets the property to the raw attribute value, discarding the resolution. Remove the duplicate addPropertyValue so the resolved value survives, matching the handling already present for fallback (a few lines above) and for the lazy registration path. Fixes spring-cloudgh-1367 Signed-off-by: seonwoo_jung <laborlawseon@kap.kr>
b2cbc2f to
843e32a
Compare
Contributor
Author
|
Thanks for the review, @ryanjbaxter! I've rebased the commit onto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes gh-1367
Summary
FeignClientsRegistrar.eagerlyRegisterFeignClientBeanDefinitionresolves thefallbackFactoryattribute viaClassUtils.resolveClassName(...)when it is supplied as aString, but the very next line unconditionally re-sets the same property to the raw attribute value, discarding the resolvedClassand rendering the resolution dead code:https://github.com/spring-cloud/spring-cloud-openfeign/blob/main/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientsRegistrar.java#L239-L244
The duplicate, unconditional
addPropertyValuemirrors a pattern that the same method already gets right forfallback(lines 234-238 — single conditional set, no overwrite) and that the lazy registration path also gets right (lazilyRegisterFeignClientBeanDefinition, lines 288-292). It looks unintentional.Change
Remove the duplicate line so the resolved value survives.
Test plan
./mvnw -pl spring-cloud-openfeign-core -am test -Dtest=FeignClientsRegistrarTests— 15 tests, 0 failures, 0 errors, 1 skipped (existingtestFallbackandtestFallbackFactorystill pass with theClass<?>annotation path).