Skip to content

Instantly share code, notes, and snippets.

@pangda0xff
Created August 13, 2019 01:56
Show Gist options
  • Save pangda0xff/a897987c9d7c8c4edc9783591bc8cafa to your computer and use it in GitHub Desktop.
Save pangda0xff/a897987c9d7c8c4edc9783591bc8cafa to your computer and use it in GitHub Desktop.
RequestMapping排除FeignClient
@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