Created
July 3, 2019 15:48
-
-
Save rbaul/ec12bb9841e445e35b4d30009239e4f8 to your computer and use it in GitHub Desktop.
Ignore FeignClient Mapping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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