Describe the bug See code below

@EnableFeignClients(defaultConfiguration = DefaultConfig.class)
@FeignClient(url = "http://localhost:8080", name = "demo", configuration = DemoConfig.class)

I expect the specific configuration for FeignClient to override the default settings from @EnableFeignClients, similar to how properties work. However, it seems to be the opposite.

The issue appears to stem from org.springframework.cloud.context.named.NamedContextFactory#createContext registering two configurations simultaneously. Since the method names for defining Options beans are identical, they overwrite each other.

If we change the method names, org.springframework.cloud.context.named.NamedContextFactory#getInstance(java.lang.String, java.lang.Class) will return null due to non-unique definitions, rendering the configurations ineffective

Sample This is my code Spring Cloud Openfeign @EnableFeignClients defaultConfiguration override @FeignClient configuration

Comment From: OlgaMaciaszek

Hello @charlesymt, thanks for creating the issue. This behaviour is by default. As stated in the docs "Default configurations can be specified in the @EnableFeignClients attribute defaultConfiguration in a similar manner as described above. The difference is that this configuration will apply to all Feign clients." There is no additional fallback logic.

To obtain the behaviour you're looking for, you should either annotate the bean definition in the DemoConfig class with @ConditionalOnMissingBean to avoid registering the default bean for that context or name the method differently and use @Primary or, after switching to Boot 3.4.0, @Fallback annotation to instantiate both beans but use the non-default one.