소스 검색

配置中心支持消息总线

gaodm 6 년 전
부모
커밋
3548359212

+ 4 - 4
config-server/pom.xml

@@ -32,10 +32,10 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-actuator</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>org.springframework.cloud</groupId>-->
+            <!--<artifactId>spring-cloud-starter-bus-amqp</artifactId>-->
+        <!--</dependency>-->
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>

+ 13 - 12
config-server/src/main/resources/application.yml

@@ -4,10 +4,10 @@
 #    config:
 #      server:
 #        git:
-#          uri: https://git.coding.net/xiaoantimes/xiaoantimes-taichi
-#          searchPaths: backend/repo
-#          username: 124746406@qq.com
-#          password:
+#          uri: http://192.168.2.153:81/config.git
+#          searchPaths: diagbotcloud/repo
+#          username: dev
+#          password: 123456
 #      label: master
 
 # ---native
@@ -19,16 +19,17 @@ spring:
           search-locations: classpath:/shared
   profiles:
      active: native
+#
   application:
     name: config-server
-  #mq
-  rabbitmq:
-    host: localhost
-    port: 5672
-    username: guest
-    password: guest
-    publisher-confirms: true
-    virtual-host: /
+#  #mq
+#  rabbitmq:
+#    host: localhost
+#    port: 5672
+#    username: guest
+#    password: guest
+#    publisher-confirms: true
+#    virtual-host: /
 
 # port
 server:

+ 6 - 1
config-server/src/main/resources/shared/application-dev.yml

@@ -48,4 +48,9 @@ feign:
   hystrix:
     enabled: true
 
-
+spring:
+  cloud:
+    bus:
+      enabled: true
+      trace:
+        enabled: true

+ 6 - 1
config-server/src/main/resources/shared/application-local.yml

@@ -48,4 +48,9 @@ feign:
   hystrix:
     enabled: true
 
-
+spring:
+  cloud:
+    bus:
+      enabled: true
+      trace:
+        enabled: true

+ 3 - 3
docker-compose.yml

@@ -21,9 +21,9 @@ services:
 #      - "data/diagbotcloud/logs:/logs"
     environment:
       - myuri=eureka1
-      - spring.rabbitmq.host=192.168.2.236
-      - spring.rabbitmq.username=lantone
-      - spring.rabbitmq.password=lantone
+#      - spring.rabbitmq.host=192.168.2.236
+#      - spring.rabbitmq.username=lantone
+#      - spring.rabbitmq.password=lantone
     depends_on:
       - eureka1
     restart: always

+ 3 - 3
user-service/src/main/java/com/diagbot/UserServiceApplication.java

@@ -33,13 +33,13 @@ public class UserServiceApplication {
 		SpringApplication.run(UserServiceApplication.class, args);
 	}
 
-	@Value("${server.port}")
-	String port;
+	@Value("${foo}")
+	String foo;
 
 	@RequestMapping("/hi")
 	@HystrixCommand(fallbackMethod = "hiError")
 	public String home(@RequestParam(value = "name", defaultValue = "gaodm") String name) {
-		return "hi " + name + " ,i am from port:" + port;
+		return "hi " + name + " ,i am from port:" + foo;
 	}
 
 	public String hiError(String name) {