فهرست منبع

config:后端项目,在网关模块中加入dubbo配置,并配置使用naocs作为注册中心;加入公共模块依赖;

yang yi 9 ماه پیش
والد
کامیت
191b017249
2فایلهای تغییر یافته به همراه54 افزوده شده و 1 حذف شده
  1. 42 1
      open-api-gateway/pom.xml
  2. 12 0
      open-api-gateway/src/main/resources/application.yaml

+ 42 - 1
open-api-gateway/pom.xml

@@ -20,7 +20,17 @@
         <maven.compiler.source>17</maven.compiler.source>
         <maven.compiler.target>17</maven.compiler.target>
     </properties>
-
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.dubbo</groupId>
+                <artifactId>dubbo-bom</artifactId>
+                <version>3.3.0</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
     <dependencies>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
@@ -31,6 +41,37 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-registry-nacos</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>space.anyi</groupId>
+            <artifactId>open-api-commom</artifactId>
+            <version>1.0.0</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.projectlombok</groupId>
+                    <artifactId>lombok</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.baomidou</groupId>
+                    <artifactId>mybatis-plus-boot-starter</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-validation</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.github.xiaoymin</groupId>
+                    <artifactId>knife4j-spring-boot-starter</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
     </dependencies>
 
 </project>

+ 12 - 0
open-api-gateway/src/main/resources/application.yaml

@@ -15,3 +15,15 @@ spring:
           filters:
             #分割路径,去掉前缀
             - StripPrefix=1
+            #因为springgateway重写name方法,所以自定义过滤器取xxxGatewayFilterFactory中xxx作为name
+#            - name: consumerGatewayFilterFactory
+logging:
+  level:
+    root: debug
+dubbo:
+  application:
+    name: open-api-gateway
+  registry:
+    address: nacos://127.0.0.1:8848
+    username: nacos
+    password: nacos