Kaynağa Gözat

本地nacos配置

xujiawei 5 yıl önce
ebeveyn
işleme
3da602970b

+ 47 - 0
pom.xml

@@ -90,6 +90,53 @@
             <artifactId>spring-cloud-context</artifactId>
         </dependency>
 
+<!--        nacos-->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-gateway</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.cloud</groupId>
+                    <artifactId>spring-boot-starter-web</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-web</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-webflux</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <!-- Nacos Client -->
+        <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-alibaba-nacos-discovery -->
+<!--        <dependency>-->
+<!--            <groupId>org.springframework.cloud</groupId>-->
+<!--            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>-->
+<!--            <version>0.9.0.RELEASE</version>-->
+<!--        </dependency>-->
+<!--        <dependency>-->
+<!--            <groupId>com.alibaba.cloud</groupId>-->
+<!--            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>-->
+<!--        </dependency>-->
+        <!-- https://mvnrepository.com/artifact/com.alibaba.cloud/spring-cloud-starter-alibaba-nacos-discovery -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+            <version>2.1.0.RELEASE</version>
+        </dependency>
+
+
+
+
+        <!-- actuator -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+
 
 
     </dependencies>

+ 0 - 13
src/main/resources/application.properties

@@ -1,13 +0,0 @@
-server.port = 8091
-server.servlet.context-path = /Bug/api/
-
-#spring.data.mongodb.host = ${MONGO_HOST:10.81.65.118}
-#spring.data.mongodb.port = ${MONGO_PORT:29019}
-#spring.data.mongodb.database = ${MONGO_DBNAME:co-report-test}
-
-spring.data.mongodb.uri= mongodb://localhost:27017/test
-
-spring.http.encoding.force = true
-spring.http.encoding.charset = UTF-8
-spring.http.encoding.enabled = true
-server.tomcat.uri-encoding = UTF-8

+ 18 - 0
src/main/resources/application.yml

@@ -0,0 +1,18 @@
+sleep: 0
+
+# 配置输出日志
+logging:
+  level:
+    org.springframework.cloud.gateway: TRACE
+    org.springframework.http.server.reactive: DEBUG
+    org.springframework.web.reactive: DEBUG
+    reactor.ipc.netty: DEBUG
+
+#开启端点
+management:
+  endpoints:
+    web:
+      exposure:
+        include: '*'
+  security:
+    enabled: false

+ 29 - 11
src/main/resources/bootstrap.yml

@@ -1,14 +1,32 @@
 spring.profiles.active: dev
 #spring.profiles.active: test
 spring:
-                          application:
-                            name: mooctest-crowdsource-backend
-                          cloud:
-                            zookeeper:
-                              enabled: true  # true:开启zookeeper外部化配置, false:读取本地配置;
-                              connect-string: 101.37.175.111:2181
-                              config:
-                                root: /config
-                                enabled: true
-                                watcher:
-                                  enabled: true
+  application:
+    name: mooctest-crowdsource-backend
+  cloud:
+    zookeeper:
+      enabled: true  # true:开启zookeeper外部化配置, false:读取本地配置;
+      connect-string: 101.37.175.111:2181
+      config:
+        root: /config
+        enabled: true
+        watcher:
+          enabled: true
+#    nacos:
+#      discovery:e.e
+#        # 指定nacos server的地址
+#        server-addr: 127.0.0.1:8848
+# actuator相关配置
+#management:
+#  endpoints:
+#    web:
+#      exposure:
+#        # 暴露所有监控端点
+#        include: '*'
+#  endpoint:
+#    health:
+#      # 总是显示健康检测详情
+#      show-details: always
+
+#server:
+#  port: 8082