Created
August 13, 2019 01:56
-
-
Save pangda0xff/a897987c9d7c8c4edc9783591bc8cafa to your computer and use it in GitHub Desktop.
RequestMapping排除FeignClient
This file contains 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 | |
public class FeignConfig { | |
@Bean | |
public WebMvcRegistrations feignWebRegistrations() { | |
return new WebMvcRegistrationsAdapter() { | |
@Override | |
public RequestMappingHandlerMapping getRequestMappingHandlerMapping() { | |
return new FeignFilterRequestMappingHandlerMapping(); | |
} | |
}; | |
} | |
private static class FeignFilterRequestMappingHandlerMapping extends RequestMappingHandlerMapping { | |
@Override | |
protected boolean isHandler(Class<?> beanType) { | |
return super.isHandler(beanType) && (AnnotationUtils.findAnnotation(beanType, FeignClient.class) == null); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment