tuonina 5 years ago
parent
commit
06c83acb91

+ 6 - 1
c-docs/设计文档.md

@@ -5,4 +5,9 @@
 - Redis
 - jdbc,mybatis
 - MongoDB
-- Spring Data Stream 集成rabbit
+- Spring Data Stream 集成rabbit
+
+
+## tuon-gateway
+基于Spring Cloud 的网关;
+如果加载了依赖,但是不想启用网关功能可用:spring.cloud.gateway.enable=false 禁用网关功能

+ 1 - 0
settings.gradle

@@ -2,4 +2,5 @@ rootProject.name = 'tuon-framework'
 include 'tuon-core'
 include 'tuon-web'
 include 'tuon-qywx'
+include 'tuon-gateway'
 

+ 8 - 0
tuon-gateway/build.gradle

@@ -0,0 +1,8 @@
+group 'cn.tonyandmoney.tuon'
+version '0.0.1'
+
+
+
+dependencies{
+    api('org.springframework.cloud:spring-cloud-starter-gateway')
+}

+ 19 - 0
tuon-gateway/src/main/resources/application-gateway.yml

@@ -0,0 +1,19 @@
+spring:
+  cloud:
+    gateway:
+      discovery:
+        locator:
+          enabled: true
+          lower-case-service-id: true
+      default-filters:
+        - name: Retry    # 进行三次重试,只对GET查询进行重试
+          args:
+            retries: 3
+            series: SERVER_ERROR
+            statuses:
+              - BAD_GATEWAY
+            methods:
+              - GET
+            exceptions:
+              - java.io.IOException
+              - java.util.concurrent.TimeoutException

+ 1 - 0
tuon-web/build.gradle

@@ -20,6 +20,7 @@ version '0.1.0'
 dependencies {
    compile project(':tuon-core')
    compile project(':tuon-qywx')
+   compile project(':tuon-gateway')
    implementation('org.springframework.boot:spring-boot-starter-webflux')
 }
 

+ 1 - 0
tuon-web/src/main/resources/bootstrap.yml

@@ -9,6 +9,7 @@ spring:
     name: tuon
   profiles:
     active: sit
+    include: gateway
   cloud:
     config:
       profile: ${spring.profiles.active}