Skip to content

Commit 6d55910

Browse files
committed
Upgrade feign to 8.11.0
Adds support for feign-hystrix fixes spring-cloudgh-606
1 parent 9e4cad7 commit 6d55910

File tree

5 files changed

+30
-2
lines changed

5 files changed

+30
-2
lines changed

Diff for: pom.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<main.basedir>${basedir}</main.basedir>
2828
<archaius.version>0.6.5</archaius.version>
2929
<eureka.version>1.2.5</eureka.version>
30-
<feign.version>8.10.0</feign.version>
30+
<feign.version>8.11.0</feign.version>
3131
<hystrix.version>1.4.18</hystrix.version>
3232
<ribbon.version>2.1.0</ribbon.version>
3333
<servo.version>0.9.4</servo.version>
@@ -281,6 +281,11 @@
281281
<artifactId>feign-httpclient</artifactId>
282282
<version>${feign.version}</version>
283283
</dependency>
284+
<dependency>
285+
<groupId>com.netflix.feign</groupId>
286+
<artifactId>feign-hystrix</artifactId>
287+
<version>${feign.version}</version>
288+
</dependency>
284289
<dependency>
285290
<groupId>com.netflix.hystrix</groupId>
286291
<artifactId>hystrix-core</artifactId>

Diff for: spring-cloud-netflix-core/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@
111111
<artifactId>feign-httpclient</artifactId>
112112
<optional>true</optional>
113113
</dependency>
114+
<dependency>
115+
<groupId>com.netflix.feign</groupId>
116+
<artifactId>feign-hystrix</artifactId>
117+
<optional>true</optional>
118+
</dependency>
114119
<dependency>
115120
<groupId>com.netflix.hystrix</groupId>
116121
<artifactId>hystrix-core</artifactId>

Diff for: spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/FeignClientFactoryBean.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import feign.codec.Decoder;
4040
import feign.codec.Encoder;
4141
import feign.codec.ErrorDecoder;
42+
import feign.hystrix.HystrixFeign;
4243
import feign.slf4j.Slf4jLogger;
4344

4445
/**
@@ -74,7 +75,7 @@ protected Feign.Builder feign(FeignClientFactory factory) {
7475
}
7576

7677
// @formatter:off
77-
Feign.Builder builder = Feign.builder()
78+
Feign.Builder builder = HystrixFeign.builder()
7879
// required values
7980
.logger(logger)
8081
.encoder(get(factory, Encoder.class))

Diff for: spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/valid/FeignClientTests.java

+13
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import org.springframework.web.bind.annotation.RequestParam;
5757
import org.springframework.web.bind.annotation.RestController;
5858

59+
import com.netflix.hystrix.HystrixCommand;
5960
import com.netflix.loadbalancer.Server;
6061
import com.netflix.loadbalancer.ServerList;
6162

@@ -106,6 +107,9 @@ protected static interface TestClient {
106107

107108
@RequestMapping(method = RequestMethod.GET, value = "/helloparams")
108109
List<String> getParams(@RequestParam("params") List<String> params);
110+
111+
@RequestMapping(method = RequestMethod.GET, value = "/hellos")
112+
HystrixCommand<List<Hello>> getHellosHystrix();
109113
}
110114

111115
@FeignClient(serviceId = "localapp")
@@ -246,6 +250,15 @@ public void testParams() {
246250
assertEquals("params size was wrong", list.size(), params.size());
247251
}
248252

253+
@Test
254+
public void testHystrixCommand() {
255+
HystrixCommand<List<Hello>> command = this.testClient.getHellosHystrix();
256+
assertNotNull("command was null", command);
257+
List<Hello> hellos = command.execute();
258+
assertNotNull("hellos was null", hellos);
259+
assertEquals("hellos didn't match", hellos, getHelloList());
260+
}
261+
249262
@Data
250263
@AllArgsConstructor
251264
@NoArgsConstructor

Diff for: spring-cloud-starter-feign/pom.xml

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
<groupId>com.netflix.feign</groupId>
4545
<artifactId>feign-slf4j</artifactId>
4646
</dependency>
47+
<dependency>
48+
<groupId>com.netflix.feign</groupId>
49+
<artifactId>feign-hystrix</artifactId>
50+
</dependency>
4751
<dependency>
4852
<groupId>org.springframework.cloud</groupId>
4953
<artifactId>spring-cloud-starter-ribbon</artifactId>

0 commit comments

Comments
 (0)