New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEATURE REQUEST:Multi Level Multiple Inheritance and Override Support #1284
Comments
@kdavisk6 Hi, I wanted to know whether you are still interested in multiple inheritance support? Maybe you can drop a comment or two on the PR and the way that this was realized. TIA! |
@kdavisk6 I was able to remove the extra code so that integrators such as spring-cloud-openfeign will only have to update their dependencies. |
@kdavisk6 currently working on a type safe detection of generic overrides. |
@kdavisk6 I have introduced the new method |
@kdavisk6 my initial tests with the current PR shows that I am able to
and this will work just fine. That way I am able to decompose the services into multiple entities and I can also reuse existing tests by simple parameterization instead of reimplementing the whole shebang all over again. And, considering a project with 20+ web services and clients, this will reduce the time spent on implementing the clients/services and test cases thereof by a lot. |
PLEASE NOTE: the dependencies listed in here will become obsolete as soon as the PR gets accepted. PLEASE NOTE: leave any comments on the associated PR #1285 and not in this issue. NOTE: any gpg signing has been disabled. For those of you who are interested in this, feel free to test this out
You will also have to add the following repository to your repositories section
and similarly so for all the other modules of the openfeign project, except for forms, that it. And if you by chance are using springframework-cloud-starter-openfeign, you will have to add this to your dependencies section or dependencyManagement/dependencies section
|
The current PR #1285 incorporates changes that will make it most versatile, reducing overall complexity and all. Feel free to test this out, see #1284 (comment) A new snapshot release has been made available. |
Note: method is now called |
@mxmlnglt I will have a look at it later in the day. It has been a while and the code still needs to be cleaned up. |
@mxmlnglt ok, here is what is contained in the last commit
There was a typo in the name 😁 |
@mxmlnglt I am actually using the build from this branch for my own project. The build was deployed, see above for more information. The build does not include any unwanted stuff, except for what is in openfeign by default. |
WIP still working on the issue and its associated PR, please bear with me
Goals
Multi Level (Generic) Inheritance With Multiple Inheritance Support at the Second (and Higher) Level And Generic Method Override
Here, the feign client interface
SomeServiceClientApi
inherits from the interfaceSomeService
, which then inherits from multiple other (generic) interfaces, sharing its interface with theSomeServiceApiController
rest controller via theSomeService
interface.or, alternatively (and most provably in combination with the above)
Decomposition of the Service Interface for both Testing and Delegation Purposes
A so composed service interface can be decomposed so that one can test indiividual features of a service a/o client using shared (generic) test classes a/o strategies, when considering standard CRUD and other operations.
One could also use delegates on the server side to realize specific facets of the service interface, e.g. one that will realize the
status
and one that will realize theretrieve
, and so on.And while the Spring framework already provides for such, Feign will currently prevent this from happening as it does not support multiple inheritance on the interface level. Basically meaning that one cannot have a service interface that is shared between both the client and the server without having to redeclare the client interface.
Positive Side Effects
Implementation Notes
Since
spring-cloud-openfeign
does override some of theprocess*
methods fromContract.BaseContract
, I resorted to just detecting when multiple methods with the same key are available.Annotations on base interfaces, except for when it is the first inherited one, are simply ignored.
Additional test cases have been introduced that provide for a basic safeguard but do not realize every possible combination.
Additional Information
spring-cloud-openfeign must be updated so as to use the new version.
PR
#1285
See also
#320, #1244, #1029
The text was updated successfully, but these errors were encountered: