Skip to content

Commit 15e50ea

Browse files
committed
Merge branch 'dev'
2 parents fa0c132 + 2fd22c9 commit 15e50ea

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

eureka-customer/pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,27 @@
6868
<artifactId>spring-cloud-starter-config</artifactId>
6969
</dependency>
7070

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+
7192
<!-- 引入Mybatis依赖 -->
7293
<dependency>
7394
<groupId>org.mybatis.spring.boot</groupId>

eureka-customer/src/main/java/com/coderqian/eurekacustomer/controller/TestController.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import io.swagger.annotations.ApiOperation;
77
import org.springframework.beans.factory.annotation.Autowired;
88
import org.springframework.beans.factory.annotation.Value;
9+
import org.springframework.cloud.context.config.annotation.RefreshScope;
910
import org.springframework.web.bind.annotation.RequestMapping;
1011
import org.springframework.web.bind.annotation.RequestMethod;
1112
import org.springframework.web.bind.annotation.RequestParam;
@@ -19,11 +20,15 @@
1920
* 测试类
2021
*/
2122

23+
@RefreshScope
2224
@RestController
2325
@RequestMapping(value = "/test")
2426
@Api(value = "测试", description = "测试模块", position = 1)
2527
public class TestController {
2628

29+
@Value("${profile}")
30+
private String profile;
31+
2732
@Autowired
2833
private TestService testService;
2934

@@ -50,4 +55,10 @@ public BaseResult testBaseResult(@RequestParam(value = "text") String text) {
5055
public BaseResult testMybatis(@RequestParam("id") String id) {
5156
return testService.testMybatis(id);
5257
}
58+
59+
@ApiOperation(value = "测试消息总线", notes = "测试消息总线")
60+
@RequestMapping(value = "/bus", method = RequestMethod.GET)
61+
public String testBus() {
62+
return profile;
63+
}
5364
}

eureka-customer/src/main/resources/bootstrap.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ spring.cloud.config.profile=master
55
spring.cloud.config.label=
66
spring.cloud.config.uri=http://127.0.0.1:1201/
77

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

feign-server/src/main/java/com/coderqian/feginserver/configuration/FeignServerConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import feign.Feign;
55
import feign.hystrix.HystrixFeign;
66
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
7+
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
78
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
89
import org.springframework.context.annotation.Bean;
910
import org.springframework.context.annotation.Configuration;
@@ -21,6 +22,7 @@ public class FeignServerConfiguration {
2122

2223
@Bean
2324
@Scope("prototype")
25+
@ConditionalOnMissingBean
2426
@ConditionalOnProperty(name = "feign.hystrix.enabled", matchIfMissing = true)
2527
public Feign.Builder feignBuilder() {
2628
return Feign.builder();

0 commit comments

Comments
 (0)