Description
Is your feature request related to a problem? Please describe.
I'm using the spring
generator with the library
option set to spring-cloud
to generate Feign clients. While the generated clients support specifying a configuration class, they do not currently support setting fallback
or fallbackFactory
.
This limitation makes it difficult to apply fallback logic, which is essential for resilience in production environments. Although many customizations can be handled via configuration classes or application.properties
, fallback behavior seems to be an exception.
Describe the solution you'd like
It would be helpful if the generator could support specifying fallback
and/or fallbackFactory
for Feign clients in the generated code. Ideally, this could be handled via generator options or annotations, allowing users to plug in their custom fallback implementations easily.
Describe alternatives you've considered
Currently, I need to manually modify the generated code to set the fallback or fallbackFactory, which undermines the purpose of code generation. Other workarounds, such as programmatically wrapping the client, are more complex and not ideal.
Additional context
Feign provides a very convenient client abstraction, and when using OpenAPI + Java + Spring, it is a strong candidate for client generation. However, the lack of fallback support in the generated code is a blocker for production usage in many cases where resilience is critical.
There was also a similar request made in the past here: #1396