Skip to content

Support parameterized base apis #133

@alexeos

Description

@alexeos

Consider the example:

public interface BaseAPI {
     @RequestLine("GET /health")
     String health();
     @RequestLine("GET /all")
     List<Entity> all();
}

And then some specific API:

public interface CustomAPI extends BaseAPI {
     @RequestLine("GET /custom")
     String custom();
}

I'd like to use CustomAPI when creating Feign client and be able to access methods of the BaseAPI.

Currently only methods defined directly in the CustomAPI are bound to handlers.

It looks like the only required changes to be made are:

1 feign.Contract.BaseContract.parseAndValidatateMetadata(Class<?> declaring):

//      for (Method method : declaring.getDeclaredMethods()) {
      for (Method method : declaring.getMethods()) {

2 feign.ReflectiveFeign.newInstance(Target<T> target):

//    for (Method method : target.type().getDeclaredMethods()) {
    for (Method method : target.type().getMethods()) {

I was able to get the required functionality with the above changes.
Would be great to have this functionality either out of the box or easily configurable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions