Skip to content

fallbackFactory property unconditionally overwritten in eagerlyRegisterFeignClientBeanDefinition #1367

Closed

Description

@sshworld

Describe the bug

In FeignClientsRegistrar.eagerlyRegisterFeignClientBeanDefinition() (Spring Cloud OpenFeign 5.0.2-SNAPSHOT / main branch), the fallbackFactory property is set twice:

  1. Lines 239-243: Conditionally set with proper ClassUtils.resolveClassName() handling
  2. Line 244: Unconditionally overwritten with the raw attribute value

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

Object fallbackFactory = attributes.get("fallbackFactory");
if (fallbackFactory != null) {
    definition.addPropertyValue("fallbackFactory", fallbackFactory instanceof Class ? fallbackFactory
            : ClassUtils.resolveClassName(fallbackFactory.toString(), null));
}
definition.addPropertyValue("fallbackFactory", attributes.get("fallbackFactory")); // always overwrites

Line 244 unconditionally overwrites the resolved value from lines 239-243, making the ClassUtils.resolveClassName() logic dead code.

This appears to be unintentional because:

  • fallback in the same method (lines 234-238) uses conditional set only — no unconditional overwrite
  • lazilyRegisterFeignClientBeanDefinition() (lines 288-292) handles fallbackFactory with conditional set only

The fix would be removing line 244 to align with both the fallback handling and the lazy registration path.

I'd be happy to submit a PR with the fix and test if you agree this is a bug.

Activity

  1. sshworld commented on Apr 6, 2026

    @sshworld
    Author

    I'd like to work on this if it's okay. The fix would be a single line removal

  2. added
    bug
    and removed on May 27, 2026
  3. moved this from Todo to In Progress in 2025.1.2on May 27, 2026
  4. moved this from Todo to In Progress in 2025.0.3on May 27, 2026
  5. added this to the 4.3.3 milestone on May 27, 2026
  6. added a commit that references this issue on May 27, 2026
    843e32a
  7. moved this from In Progress to Done in 2025.0.3on May 27, 2026
  8. moved this from In Progress to Done in 2025.1.2on May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions