-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Allow to ignore methods on provided interface #686
Comments
Would it make more sense to ignore all non-default methods not annotated with |
IMO, the cleaner solution would be to make multiple interfaces (your concrete class on the server side can implement them both). The one for Feign, the other for your queue. But if you are unable to do that for some (business-related?) reason, then it is likely you do not have control of the interface and thus can't add any sort of So if Feign wants to support this, then (again, IMO -- YMMV) I think it should ignore all methods it doesn't recognize as supported. |
We are doing exactly that just now - splitting the interface :) |
Complete untested and unverified suggestion, but has anyone tried to extend the interface ala Spring Data? interface MyCustomInterface {
void myCustomMethod();
}
class MyCustomIntefaceImpl implements MyCustomInterface {
public void myCustomMethod() {
...
}
} interface FeignClient extends MyCustomInterface {
@RequestLine()
public Foo myServiceCall();
} I have no idea if there is some Spring magic going on here however. |
From #615, we may want to consider either adding an explicit |
As a user, having Feign only proxy annotated methods makes more sense and addresses the issue in this request and in #615. |
I want to ignore some method on api interface too. |
Any progress here? |
4 years have passed |
Would be very practical to ignore default methods especilly for generated interfaces, for instance, from Open API |
Default methods are not handled by feign. They are invoked as is
|
Is there any updates for this proposal? |
Hi @DanielLiu1123 well, still waiting of someone to take charge and make it happen. I can review and guide as needed, just don't have the time to do it myself |
When the Feign annotated interface (or class passed to the builder) contains methods that are not intended to be invoked by a web request (i.e. not annotated with RequestMapping), Feign (actually the BaseContract) throws an exception saying the method is not annotated with HTTP method type.
While this is legitimate, I'd like to request an enhancement to allow the contract to ignore methods on demand (kinda like it ignores static methods), for example via some annotation ("@FeignIgnore"?).
The motivation for this is that the same interface class can be used in different contexts, not just for http based communication. Specifically, we use the same interface class both for Feign and for sending messages to remote services via a queue - if there is a method that should only be invoked through a queue, we'd expect it to not be annotated with RequestMapping, which causes Feign to fail to process the class entirely.
The text was updated successfully, but these errors were encountered: