Upgrade feign to 8.11.0
Adds support for feign-hystrix fixes gh-606
This commit is contained in:
7
pom.xml
7
pom.xml
@@ -27,7 +27,7 @@
|
||||
<main.basedir>${basedir}</main.basedir>
|
||||
<archaius.version>0.6.5</archaius.version>
|
||||
<eureka.version>1.2.5</eureka.version>
|
||||
<feign.version>8.10.0</feign.version>
|
||||
<feign.version>8.11.0</feign.version>
|
||||
<hystrix.version>1.4.18</hystrix.version>
|
||||
<ribbon.version>2.1.0</ribbon.version>
|
||||
<servo.version>0.9.4</servo.version>
|
||||
@@ -281,6 +281,11 @@
|
||||
<artifactId>feign-httpclient</artifactId>
|
||||
<version>${feign.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-hystrix</artifactId>
|
||||
<version>${feign.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.hystrix</groupId>
|
||||
<artifactId>hystrix-core</artifactId>
|
||||
|
||||
@@ -111,6 +111,11 @@
|
||||
<artifactId>feign-httpclient</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-hystrix</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.hystrix</groupId>
|
||||
<artifactId>hystrix-core</artifactId>
|
||||
|
||||
@@ -39,6 +39,7 @@ import feign.Retryer;
|
||||
import feign.codec.Decoder;
|
||||
import feign.codec.Encoder;
|
||||
import feign.codec.ErrorDecoder;
|
||||
import feign.hystrix.HystrixFeign;
|
||||
import feign.slf4j.Slf4jLogger;
|
||||
|
||||
/**
|
||||
@@ -74,7 +75,7 @@ class FeignClientFactoryBean implements FactoryBean<Object>, InitializingBean, A
|
||||
}
|
||||
|
||||
// @formatter:off
|
||||
Feign.Builder builder = Feign.builder()
|
||||
Feign.Builder builder = HystrixFeign.builder()
|
||||
// required values
|
||||
.logger(logger)
|
||||
.encoder(get(factory, Encoder.class))
|
||||
|
||||
@@ -56,6 +56,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.netflix.hystrix.HystrixCommand;
|
||||
import com.netflix.loadbalancer.Server;
|
||||
import com.netflix.loadbalancer.ServerList;
|
||||
|
||||
@@ -106,6 +107,9 @@ public class FeignClientTests {
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/helloparams")
|
||||
List<String> getParams(@RequestParam("params") List<String> params);
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/hellos")
|
||||
HystrixCommand<List<Hello>> getHellosHystrix();
|
||||
}
|
||||
|
||||
@FeignClient(serviceId = "localapp")
|
||||
@@ -246,6 +250,15 @@ public class FeignClientTests {
|
||||
assertEquals("params size was wrong", list.size(), params.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHystrixCommand() {
|
||||
HystrixCommand<List<Hello>> command = this.testClient.getHellosHystrix();
|
||||
assertNotNull("command was null", command);
|
||||
List<Hello> hellos = command.execute();
|
||||
assertNotNull("hellos was null", hellos);
|
||||
assertEquals("hellos didn't match", hellos, getHelloList());
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
|
||||
@@ -44,6 +44,10 @@
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-slf4j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-hystrix</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-ribbon</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user