Skip to content

Instantly share code, notes, and snippets.

@rbaul
Created July 3, 2019 15:48
Show Gist options
  • Select an option

  • Save rbaul/ec12bb9841e445e35b4d30009239e4f8 to your computer and use it in GitHub Desktop.

Select an option

Save rbaul/ec12bb9841e445e35b4d30009239e4f8 to your computer and use it in GitHub Desktop.
Ignore FeignClient Mapping
@Configuration
@ConditionalOnClass({ Feign.class })
public class FeignConfig {
@Bean
public WebMvcRegistrations feignWebRegistrations() {
return new WebMvcRegistrations() {
@Override
public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
return new FeignFilterRequestMappingHandlerMapping();
}
};
}
/**
* Ignore Mapping on FeignClient
*/
private static class FeignFilterRequestMappingHandlerMapping extends RequestMappingHandlerMapping {
@Override
protected boolean isHandler(Class<?> beanType) {
return super.isHandler(beanType) && !AnnotatedElementUtils.hasAnnotation(beanType, FeignClient.class);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment