用Ribbon Interceptor调用RestTemplate

时间:2015-07-05 21:44:19

标签: spring-boot spring-cloud resttemplate spring-cloud-netflix

我正在尝试将RestTemplate@EnableDiscoveryClient一起使用,最终调用Ribbon Interceptor。在调用堆栈中,最后进行以下调用:

org.springframework.cloud.netflix.ribbon.RibbonClientHttpRequestFactory$
RibbonHttpRequest.getBodyInternal(RibbonClientHttpRequestFactory.java:105)

现在,这是getBodyInternal方法的代码:

 @Override
 protected OutputStream getBodyInternal(HttpHeaders headers) throws IOException {
        throw new RuntimeException("Not implemented");
 }

我的问题是哪些案例会导致这种未实施的方法,我该如何避免这种情况?我正在使用RestTemplate.postForLocation。一般的假设是不应该使用Ribbon拦截器调用此方法吗?

1 个答案:

答案 0 :(得分:2)

尝试使用版本1.0.3.RELEASE,它是spring-cloud-starter-parent:Angel.SR3的一部分。该方法已经实施。

相关问题