相关疑难解决方法(0)

使用spring启动应用程序属性设置tomcat属性

我想为引导提供的tomcat设置maxSwallowSize属性.我的application.properties有这一行:

server.context-parameters.maxSwallowSize=20971520 
Run Code Online (Sandbox Code Playgroud)

由于某种原因不起作用.server.port等其他属性运行良好.在TomcatEmbeddedServletContainerFactory中调试创建我看到有一个带有此属性的ServletContexInitializer(InitParameterConfiguringServletContextInitializer),但它似乎没有以任何方式使用.(即使它在变量名中initializersToUse,具有讽刺意味; p)

当上传超过设置的最大尺寸时,我不喜欢杀死连接

multipart.max-request-size=10MB
multipart.max-file-size=2MB
Run Code Online (Sandbox Code Playgroud)

这是设置此属性的正确方法吗?在调试过程中,我可以看到IdentityInputFilter的默认值为2MB.

最新版本的org.springframework.boot:spring-boot-starter-web

java spring tomcat spring-mvc spring-boot

3
推荐指数
1
解决办法
5062
查看次数

标签 统计

java ×1

spring ×1

spring-boot ×1

spring-mvc ×1

tomcat ×1