gaodd 1 vuosi sitten
vanhempi
commit
91be8ad964

+ 13 - 0
pom.xml

@@ -32,6 +32,19 @@
32 32
             <artifactId>spring-boot-starter-test</artifactId>
33 33
             <scope>test</scope>
34 34
         </dependency>
35
+        
36
+        <!--监控-->
37
+        <dependency>
38
+            <groupId>org.springframework.boot</groupId>
39
+            <artifactId>spring-boot-starter-actuator</artifactId>
40
+        </dependency> 
41
+        
42
+        <!--添加消息总线Rabbitmq支持-->
43
+        <dependency>
44
+            <groupId>org.springframework.cloud</groupId>
45
+            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
46
+        </dependency>
47
+        
35 48
     </dependencies>
36 49
     <dependencyManagement>
37 50
         <dependencies>

+ 3 - 0
src/main/java/com/unis/ConfigServerApplication.java

@@ -2,12 +2,15 @@ package com.unis;
2 2
 
3 3
 import org.springframework.boot.SpringApplication;
4 4
 import org.springframework.boot.autoconfigure.SpringBootApplication;
5
+import org.springframework.cloud.config.server.EnableConfigServer;
5 6
 
7
+@EnableConfigServer
6 8
 @SpringBootApplication
7 9
 public class ConfigServerApplication {
8 10
 
9 11
     public static void main(String[] args) {
10 12
         SpringApplication.run(ConfigServerApplication.class, args);
13
+       
11 14
     }
12 15
 
13 16
 }

+ 35 - 1
src/main/resources/application.yml

@@ -2,6 +2,40 @@ server:
2 2
   port: 11040
3 3
   tomcat:
4 4
     uri-encoding: UTF-8
5
+
6
+    
7
+
8
+eureka:
9
+  client:
10
+    serviceUrl:
11
+      defaultZone: http://localhost:9001/eureka/
12
+      
5 13
 spring:
6 14
   application:
7
-    name: config
15
+    name: config
16
+  cloud:
17
+    config:
18
+      server:
19
+        git:
20
+          uri: http://101.36.160.140:21044/province-qinghai/config-file.git
21
+          search-paths:  #搜索目录
22
+            - config-file
23
+          username: gdd
24
+          password: 407558gaodan
25
+      label: master #读取分支
26
+      
27
+  # 使用 bus 实现热更新
28
+  rabbitmq:
29
+    host: 172.16.0.2
30
+    port: 5672
31
+    username: admin
32
+    password: admin
33
+    
34
+    
35
+# 暴露监控端点
36
+management:
37
+  endpoints:
38
+    web:
39
+      exposure:
40
+        include: "bus-refresh"   
41
+