File tree 5 files changed +30
-2
lines changed
spring-cloud-netflix-core
main/java/org/springframework/cloud/netflix/feign
test/java/org/springframework/cloud/netflix/feign/valid
spring-cloud-starter-feign
5 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 27
27
<main .basedir>${basedir} </main .basedir>
28
28
<archaius .version>0.6.5</archaius .version>
29
29
<eureka .version>1.2.5</eureka .version>
30
- <feign .version>8.10 .0</feign .version>
30
+ <feign .version>8.11 .0</feign .version>
31
31
<hystrix .version>1.4.18</hystrix .version>
32
32
<ribbon .version>2.1.0</ribbon .version>
33
33
<servo .version>0.9.4</servo .version>
281
281
<artifactId >feign-httpclient</artifactId >
282
282
<version >${feign.version} </version >
283
283
</dependency >
284
+ <dependency >
285
+ <groupId >com.netflix.feign</groupId >
286
+ <artifactId >feign-hystrix</artifactId >
287
+ <version >${feign.version} </version >
288
+ </dependency >
284
289
<dependency >
285
290
<groupId >com.netflix.hystrix</groupId >
286
291
<artifactId >hystrix-core</artifactId >
Original file line number Diff line number Diff line change 111
111
<artifactId >feign-httpclient</artifactId >
112
112
<optional >true</optional >
113
113
</dependency >
114
+ <dependency >
115
+ <groupId >com.netflix.feign</groupId >
116
+ <artifactId >feign-hystrix</artifactId >
117
+ <optional >true</optional >
118
+ </dependency >
114
119
<dependency >
115
120
<groupId >com.netflix.hystrix</groupId >
116
121
<artifactId >hystrix-core</artifactId >
Original file line number Diff line number Diff line change 39
39
import feign .codec .Decoder ;
40
40
import feign .codec .Encoder ;
41
41
import feign .codec .ErrorDecoder ;
42
+ import feign .hystrix .HystrixFeign ;
42
43
import feign .slf4j .Slf4jLogger ;
43
44
44
45
/**
@@ -74,7 +75,7 @@ protected Feign.Builder feign(FeignClientFactory factory) {
74
75
}
75
76
76
77
// @formatter:off
77
- Feign .Builder builder = Feign .builder ()
78
+ Feign .Builder builder = HystrixFeign .builder ()
78
79
// required values
79
80
.logger (logger )
80
81
.encoder (get (factory , Encoder .class ))
Original file line number Diff line number Diff line change 56
56
import org .springframework .web .bind .annotation .RequestParam ;
57
57
import org .springframework .web .bind .annotation .RestController ;
58
58
59
+ import com .netflix .hystrix .HystrixCommand ;
59
60
import com .netflix .loadbalancer .Server ;
60
61
import com .netflix .loadbalancer .ServerList ;
61
62
@@ -106,6 +107,9 @@ protected static interface TestClient {
106
107
107
108
@ RequestMapping (method = RequestMethod .GET , value = "/helloparams" )
108
109
List <String > getParams (@ RequestParam ("params" ) List <String > params );
110
+
111
+ @ RequestMapping (method = RequestMethod .GET , value = "/hellos" )
112
+ HystrixCommand <List <Hello >> getHellosHystrix ();
109
113
}
110
114
111
115
@ FeignClient (serviceId = "localapp" )
@@ -246,6 +250,15 @@ public void testParams() {
246
250
assertEquals ("params size was wrong" , list .size (), params .size ());
247
251
}
248
252
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
+
249
262
@ Data
250
263
@ AllArgsConstructor
251
264
@ NoArgsConstructor
Original file line number Diff line number Diff line change 44
44
<groupId >com.netflix.feign</groupId >
45
45
<artifactId >feign-slf4j</artifactId >
46
46
</dependency >
47
+ <dependency >
48
+ <groupId >com.netflix.feign</groupId >
49
+ <artifactId >feign-hystrix</artifactId >
50
+ </dependency >
47
51
<dependency >
48
52
<groupId >org.springframework.cloud</groupId >
49
53
<artifactId >spring-cloud-starter-ribbon</artifactId >
You can’t perform that action at this time.
0 commit comments