Spring Boot Configure maxSwallowSize Tomcat

The Spring Boot Configure maxSwallowSize Tomcat tutorial shows you to configure maxSwallowSize in embedded Tomcat. Actually, you can’t configure the embedded Tomcat maxSwallowSize via the common application properties in Spring Boot. As i know this properties be used to specify the init parameters of the servlet context. However, maxSwallowSize is a property of the connector. That’s a different but we can always configure it via our own TomcatEmbeddedServletContainerFactory.

Other interesting posts you may like

Solution
We need to declare a TomcatEmbeddedServletContainerFactory bean and configure the maxSwallowSize like below:

Note
maxSwallowSize: The maximum number of request body bytes (excluding transfer encoding overhead) that will be swallowed by Tomcat for an aborted upload. An aborted upload is when Tomcat knows that the request body is going to be ignored but the client still sends it. If Tomcat does not swallow the body the client is unlikely to see the response. If not specified the default of 2 megabytes will be used. A value of less than zero indicates that no limit should be enforced.

That’s all on the Spring Boot Configure maxSwallowSize Tomcat tutorial.

References
common application properties
The HTTP Connector

Leave a Comment

*

Please share it if you found this useful
Hide Buttons