mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
网关二合一
This commit is contained in:
@@ -26,23 +26,15 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-gateway-common</artifactId>
|
||||
<!-- 使用zuul作为网关 -->
|
||||
<!--<artifactId>sop-bridge-zuul</artifactId>-->
|
||||
<!-- 使用spring cloud gateway作为网关 -->
|
||||
<artifactId>sop-bridge-gateway</artifactId>
|
||||
<version>2.5.10-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ↓↓↓ 使用spring cloud zuul ↓↓↓ -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.retry</groupId>
|
||||
<artifactId>spring-retry</artifactId>
|
||||
</dependency>
|
||||
<!-- ↑↑↑ 使用spring cloud zuul ↑↑↑ -->
|
||||
|
||||
<dependency>
|
||||
<groupId>net.oschina.durcframework</groupId>
|
||||
<artifactId>fastmybatis-spring-boot-starter</artifactId>
|
||||
@@ -70,17 +62,6 @@
|
||||
</dependency>
|
||||
<!-- 注册中心end -->
|
||||
|
||||
<!--
|
||||
这里依赖springboot版本,非cloud版本。
|
||||
如果依赖了spring-cloud-starter-alibaba-nacos-config,需要额外配置一个bootstrap.properties
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.boot</groupId>
|
||||
<artifactId>nacos-config-spring-boot-starter</artifactId>
|
||||
<version>${nacos-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@@ -2,13 +2,7 @@ package com.gitee.sop.gateway;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
|
||||
|
||||
// 开启网关功能
|
||||
@EnableZuulProxy
|
||||
// 扫描自定义的servlet(类上标注@WebServle)
|
||||
@ServletComponentScan
|
||||
@SpringBootApplication
|
||||
public class SopGatewayApplication {
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.gitee.sop.gateway.config;
|
||||
|
||||
import com.gitee.sop.gatewaycommon.gateway.configuration.AlipayGatewayConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -13,7 +13,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
* 开通支付宝开放平台能力
|
||||
* @author tanghc
|
||||
*/
|
||||
@Configuration
|
||||
//@Configuration
|
||||
public class ZuulConfig extends AlipayZuulConfiguration {
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
server.port=8081
|
||||
# 固定不变
|
||||
# 固定不变,不能改
|
||||
spring.application.name=sop-gateway
|
||||
|
||||
# ------- 需要改的配置 -------
|
||||
@@ -10,56 +10,15 @@ mysql.password=root
|
||||
|
||||
# nacos地址
|
||||
nacos.url=127.0.0.1:8848
|
||||
|
||||
# zipkin服务监控地址,没有开启不用改
|
||||
zipkin.url=http://127.0.0.1:9411/
|
||||
|
||||
# 预发布网关域名
|
||||
pre.domain=localhost
|
||||
# ------- 需要改的配置end -------
|
||||
|
||||
# 入口地址,不用改,默认是/zuul
|
||||
zuul.servlet-path=/api
|
||||
# 禁用默认的过滤器,不能删,不用改
|
||||
zuul.FormBodyWrapperFilter.pre.disable=true
|
||||
zuul.Servlet30WrapperFilter.pre.disable=true
|
||||
# 不用改,如果要改,请全局替换修改
|
||||
zuul.secret=MZZOUSTua6LzApIWXCwEgbBmxSzpzC
|
||||
# 不用改
|
||||
zuul.rest-default-version=1.0
|
||||
|
||||
# https://blog.csdn.net/qq_36872046/article/details/81058045
|
||||
# 路由转发超时时间,毫秒,默认值1000,详见:RibbonClientConfiguration.DEFAULT_READ_TIMEOUT。
|
||||
# 如果微服务端 处理时间过长,会导致ribbon read超时,解决办法将这个值调大一点
|
||||
ribbon.ReadTimeout=2000
|
||||
# 设置为true(默认false),则所有请求都重试,默认只支持get请求重试
|
||||
# 请谨慎设置,因为post请求大多都是写入请求,如果要支持重试,确保服务的幂等性
|
||||
ribbon.OkToRetryOnAllOperations=false
|
||||
|
||||
# nacos cloud配置
|
||||
spring.cloud.nacos.discovery.server-addr=${nacos.url}
|
||||
nacos.config.server-addr=${nacos.url}
|
||||
|
||||
# 数据库配置
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://${mysql.host}/sop?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
|
||||
spring.datasource.username=${mysql.username}
|
||||
spring.datasource.password=${mysql.password}
|
||||
|
||||
# 不用改
|
||||
mybatis.fill.com.gitee.fastmybatis.core.support.DateFillInsert=gmt_create
|
||||
mybatis.fill.com.gitee.fastmybatis.core.support.DateFillUpdate=gmt_modified
|
||||
|
||||
# 文件上传配置
|
||||
spring.servlet.multipart.enabled=true
|
||||
# 这里设置大一点没关系,真实大小由upload.max-file-size控制
|
||||
spring.servlet.multipart.max-file-size=50MB
|
||||
|
||||
# 允许上传文件大小,不能超过这个值,单位:B,KB,MB
|
||||
upload.max-file-size=2MB
|
||||
|
||||
# zipkin服务跟踪
|
||||
spring.zipkin.base-url=${zipkin.url}
|
||||
# 设置sleuth收集信息的比率,默认0.1,最大是1,数字越大越耗性能
|
||||
spring.sleuth.sampler.probability=1
|
||||
|
||||
logging.level.com.gitee=debug
|
Reference in New Issue
Block a user