File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed
java/com/coderqian/eurekacustomer/controller
feign-server/src/main/java/com/coderqian/feginserver/configuration Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 68
68
<artifactId >spring-cloud-starter-config</artifactId >
69
69
</dependency >
70
70
71
+
72
+ <dependency >
73
+ <groupId >org.springframework.cloud</groupId >
74
+ <artifactId >spring-cloud-starter-bus-amqp</artifactId >
75
+ </dependency >
76
+
77
+ <dependency >
78
+ <groupId >org.springframework.boot</groupId >
79
+ <artifactId >spring-boot-starter-actuator</artifactId >
80
+ </dependency >
81
+
82
+ <dependency >
83
+ <groupId >org.springframework.retry</groupId >
84
+ <artifactId >spring-retry</artifactId >
85
+ </dependency >
86
+
87
+ <dependency >
88
+ <groupId >org.springframework.boot</groupId >
89
+ <artifactId >spring-boot-starter-aop</artifactId >
90
+ </dependency >
91
+
71
92
<!-- 引入Mybatis依赖 -->
72
93
<dependency >
73
94
<groupId >org.mybatis.spring.boot</groupId >
Original file line number Diff line number Diff line change 6
6
import io .swagger .annotations .ApiOperation ;
7
7
import org .springframework .beans .factory .annotation .Autowired ;
8
8
import org .springframework .beans .factory .annotation .Value ;
9
+ import org .springframework .cloud .context .config .annotation .RefreshScope ;
9
10
import org .springframework .web .bind .annotation .RequestMapping ;
10
11
import org .springframework .web .bind .annotation .RequestMethod ;
11
12
import org .springframework .web .bind .annotation .RequestParam ;
19
20
* 测试类
20
21
*/
21
22
23
+ @ RefreshScope
22
24
@ RestController
23
25
@ RequestMapping (value = "/test" )
24
26
@ Api (value = "测试" , description = "测试模块" , position = 1 )
25
27
public class TestController {
26
28
29
+ @ Value ("${profile}" )
30
+ private String profile ;
31
+
27
32
@ Autowired
28
33
private TestService testService ;
29
34
@@ -50,4 +55,10 @@ public BaseResult testBaseResult(@RequestParam(value = "text") String text) {
50
55
public BaseResult testMybatis (@ RequestParam ("id" ) String id ) {
51
56
return testService .testMybatis (id );
52
57
}
58
+
59
+ @ ApiOperation (value = "测试消息总线" , notes = "测试消息总线" )
60
+ @ RequestMapping (value = "/bus" , method = RequestMethod .GET )
61
+ public String testBus () {
62
+ return profile ;
63
+ }
53
64
}
Original file line number Diff line number Diff line change @@ -5,3 +5,10 @@ spring.cloud.config.profile=master
5
5
spring.cloud.config.label =
6
6
spring.cloud.config.uri =http://127.0.0.1:1201/
7
7
8
+ spring.rabbitmq.host =127.0.0.1
9
+ spring.rabbitmq.port =5672
10
+ spring.rabbitmq.username =guest
11
+ spring.rabbitmq.password =guest
12
+ management.security.enabled =false
13
+
14
+ # management.endpoints.web.exposure.include=bus-refresh
Original file line number Diff line number Diff line change 4
4
import feign .Feign ;
5
5
import feign .hystrix .HystrixFeign ;
6
6
import org .springframework .boot .autoconfigure .condition .ConditionalOnClass ;
7
+ import org .springframework .boot .autoconfigure .condition .ConditionalOnMissingBean ;
7
8
import org .springframework .boot .autoconfigure .condition .ConditionalOnProperty ;
8
9
import org .springframework .context .annotation .Bean ;
9
10
import org .springframework .context .annotation .Configuration ;
@@ -21,6 +22,7 @@ public class FeignServerConfiguration {
21
22
22
23
@ Bean
23
24
@ Scope ("prototype" )
25
+ @ ConditionalOnMissingBean
24
26
@ ConditionalOnProperty (name = "feign.hystrix.enabled" , matchIfMissing = true )
25
27
public Feign .Builder feignBuilder () {
26
28
return Feign .builder ();
You can’t perform that action at this time.
0 commit comments