From 581b4c869b2953d46ffca5ea5d64807e17926f62 Mon Sep 17 00:00:00 2001 From: tanghc Date: Fri, 5 Mar 2021 16:59:23 +0800 Subject: [PATCH] 4.3.0 --- .../config/SopGatewayEnvironmentPostProcessor.java | 12 ------------ .../src/main/resources/META-INF/gateway.properties | 2 ++ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/config/SopGatewayEnvironmentPostProcessor.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/config/SopGatewayEnvironmentPostProcessor.java index 233d843f..6161ecb8 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/config/SopGatewayEnvironmentPostProcessor.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/config/SopGatewayEnvironmentPostProcessor.java @@ -7,7 +7,6 @@ import org.springframework.core.env.PropertiesPropertySource; import org.springframework.core.env.PropertySource; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; -import org.springframework.util.unit.DataSize; import java.io.IOException; import java.util.Properties; @@ -32,21 +31,10 @@ public class SopGatewayEnvironmentPostProcessor implements EnvironmentPostProces } try { properties.load(resource.getInputStream()); - this.initMemSize(properties); return new PropertiesPropertySource(resource.getFilename(), properties); } catch (IOException ex) { throw new IllegalStateException("加载配置文件失败" + resource, ex); } } - private void initMemSize(Properties properties) { - String maxFileSizeKey = "spring.servlet.multipart.max-file-size"; - String maxMemSizeKey = "spring.codec.max-in-memory-size"; - String defaultSize = "10MB"; - String maxUploadSize = properties.getProperty(maxFileSizeKey, defaultSize); - String maxBodySize = properties.getProperty(maxMemSizeKey, defaultSize); - long size = Math.max(DataSize.parse(maxUploadSize).toBytes(), DataSize.parse(maxBodySize).toBytes()); - properties.put(maxMemSizeKey, size); - } - } diff --git a/sop-gateway/src/main/resources/META-INF/gateway.properties b/sop-gateway/src/main/resources/META-INF/gateway.properties index 04a47379..09ddd169 100644 --- a/sop-gateway/src/main/resources/META-INF/gateway.properties +++ b/sop-gateway/src/main/resources/META-INF/gateway.properties @@ -6,6 +6,8 @@ sop.secret=MZZOUSTua6LzApIWXCwEgbBmxSzpzC # \u6587\u4EF6\u4E0A\u4F20\u914D\u7F6E spring.servlet.multipart.enabled=true spring.servlet.multipart.max-file-size=10MB +# \u4E0D\u9650\u5236gateway\u8BF7\u6C42\u4F53\u5927\u5C0F +spring.codec.max-in-memory-size=-1 # \u7F51\u5173\u5165\u53E3 sop.gateway-index-path=/