Skip to content

Instantly share code, notes, and snippets.

@hellboy81
Created June 26, 2019 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellboy81/767a60c4278de5726074b14a2f278bf2 to your computer and use it in GitHub Desktop.
Save hellboy81/767a60c4278de5726074b14a2f278bf2 to your computer and use it in GitHub Desktop.
Make MyFeignConfiguration generic
@Configuration
public class MyFeignConfiguration {
// TODO: generify MyApiClient
@Bean
public <T extends MyApiClient.Api> T apiClient(final Class<T> api) {
...
// How to generify MyApiClient ?
ApiClient client = new MyApiClient();
...
}
// TODO: generify MyApiClient
@Bean
public <T extends MyApiClient.Api> ErrorDecoder getGenericErrorDecoder(final Class<T> api) {
return AnnotationErrorDecoder
.builderFor(api)
.withResponseBodyDecoder(decoder)
.build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment