Skip to content

[BUG][JAVA] Multiple generated Feign clients are not working #17847

@MelleD

Description

@MelleD

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)

Description
If different Feign clients are generated, then multiple ClientConfigurations will be created with the same beans. This means that the clients cannot be initialized.

In my opinion, the @Configuration should be removed and the configuration should be specified in @EnableFeignClient or is currently also directly in the FeignClient. So it works without @Configuration.

The bigger issue is the ClientPropertiesConfiguration which loads, the properties. Maybe there should be a flag if the ClientPropertiesConfiguration should be generated or not. And also can be imported with @import from spring
https://www.baeldung.com/spring-import-annotation

Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'clientConfiguration' for bean class [test.client2.config.ClientConfiguration] conflicts with existing, non-compatible bean definition of same name and class [test.client1.config.ClientConfiguration]
openapi-generator version
7.3.0

Steps to reproduce
See example here:
https://github.com/MelleD/open-api-feign-client-example

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions