File tree Expand file tree Collapse file tree 4 files changed +24
-1
lines changed
2-Dalston版教程示例/eureka-consumer-feign-hystrix Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 32
32
<groupId >org.springframework.cloud</groupId >
33
33
<artifactId >spring-cloud-starter-feign</artifactId >
34
34
</dependency >
35
+ <dependency >
36
+ <groupId >org.springframework.cloud</groupId >
37
+ <artifactId >spring-cloud-starter-hystrix</artifactId >
38
+ </dependency >
35
39
<dependency >
36
40
<groupId >org.springframework.boot</groupId >
37
41
<artifactId >spring-boot-starter-web</artifactId >
Original file line number Diff line number Diff line change 8
8
* @create 2017/6/24.
9
9
* @blog http://blog.didispace.com
10
10
*/
11
- @ FeignClient ("eureka-client" )
11
+ @ FeignClient (name = "eureka-client" , fallback = DcClientFallback . class )
12
12
public interface DcClient {
13
13
14
14
@ GetMapping ("/dc" )
Original file line number Diff line number Diff line change
1
+ package com .didispace ;
2
+
3
+ import org .springframework .stereotype .Component ;
4
+
5
+ /**
6
+ * @author 翟永超
7
+ * @create 2017/6/24.
8
+ * @blog http://blog.didispace.com
9
+ */
10
+ @ Component
11
+ public class DcClientFallback implements DcClient {
12
+
13
+ @ Override
14
+ public String consumer () {
15
+ return "fallback" ;
16
+ }
17
+ }
Original file line number Diff line number Diff line change @@ -3,4 +3,6 @@ server.port=2101
3
3
4
4
eureka.client.serviceUrl.defaultZone =http://localhost:1001/eureka/
5
5
6
+ feign.hystrix.enabled =true
7
+
6
8
logging.file =${spring.application.name}.log
You can’t perform that action at this time.
0 commit comments