From c62f13e897d5641b7472ed3c83386ee075e92b2c Mon Sep 17 00:00:00 2001 From: tanghc Date: Thu, 30 Jul 2020 12:27:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=B7=E6=B1=82=E4=BD=93?= =?UTF-8?q?=E8=B6=85=E8=BF=87256KB=E6=97=A0=E6=B3=95=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gateway/codec/MessageReaderFactory.java | 4 ++ .../src/main/resources/sop-bridge.properties | 39 ------------------- .../resources/META-INF/gateway.properties | 5 ++- 3 files changed, 7 insertions(+), 41 deletions(-) delete mode 100644 sop-common/sop-gateway-common/src/main/resources/sop-bridge.properties diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/codec/MessageReaderFactory.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/codec/MessageReaderFactory.java index 2ddf6f79..95d6ff56 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/codec/MessageReaderFactory.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/codec/MessageReaderFactory.java @@ -16,11 +16,15 @@ public class MessageReaderFactory { public static final String METHOD_SET_MAX_IN_MEMORY_SIZE = "setMaxInMemorySize"; public static final String METHOD_GET_DECODER = "getDecoder"; + public static final int DEFAULT_SIZE = 256 * 1024; public static List> build() { String maxInMemorySizeValueStr = EnvironmentKeys.MAX_IN_MEMORY_SIZE.getValue(); int maxInMemorySizeValue = Integer.parseInt(maxInMemorySizeValueStr); List> messageReaders = HandlerStrategies.withDefaults().messageReaders(); + if (DEFAULT_SIZE == maxInMemorySizeValue) { + return messageReaders; + } // 设置POST缓存大小 for (HttpMessageReader httpMessageReader : messageReaders) { Method[] methods = ReflectionUtils.getDeclaredMethods(httpMessageReader.getClass()); diff --git a/sop-common/sop-gateway-common/src/main/resources/sop-bridge.properties b/sop-common/sop-gateway-common/src/main/resources/sop-bridge.properties deleted file mode 100644 index 0535c7b5..00000000 --- a/sop-common/sop-gateway-common/src/main/resources/sop-bridge.properties +++ /dev/null @@ -1,39 +0,0 @@ -# 固定不变,不能改 -spring.application.name=sop-gateway -# 不用改,如果要改,请全局替换修改 -sop.secret=MZZOUSTua6LzApIWXCwEgbBmxSzpzC - -# 网关入口 -sop.gateway-index-path=/ - -# nacos cloud配置 -spring.cloud.nacos.discovery.server-addr=${register.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} - -# 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 - -spring.cloud.gateway.discovery.locator.lower-case-service-id=true -spring.cloud.gateway.discovery.locator.enabled=true - -# 不用改 -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 \ No newline at end of file diff --git a/sop-gateway/src/main/resources/META-INF/gateway.properties b/sop-gateway/src/main/resources/META-INF/gateway.properties index b63440c6..8f978c46 100644 --- a/sop-gateway/src/main/resources/META-INF/gateway.properties +++ b/sop-gateway/src/main/resources/META-INF/gateway.properties @@ -26,8 +26,9 @@ spring.cloud.gateway.discovery.locator.enabled=true mybatis.fill.com.gitee.fastmybatis.core.support.DateFillInsert=gmt_create mybatis.fill.com.gitee.fastmybatis.core.support.DateFillUpdate=gmt_modified -# POST请求最大缓存512KB -spring.codec.max-in-memory-size=524288 +# POST请求最大缓存,默认是256KB,即:262144 +# 如果需要传输大文本可以把值设置高一点 +spring.codec.max-in-memory-size=262144 # 文件上传配置 spring.servlet.multipart.enabled=true