Skip to content

Instantly share code, notes, and snippets.

@dalesupa22
Created June 9, 2015 14:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalesupa22/2b5f67afd7a8b3a39714 to your computer and use it in GitHub Desktop.
Save dalesupa22/2b5f67afd7a8b3a39714 to your computer and use it in GitHub Desktop.
How to edit the default maxPostSize of embedded Tomcat in SpringBoot
@Bean
EmbeddedServletContainerCustomizer containerCustomizer(
) throws Exception {
return (ConfigurableEmbeddedServletContainer container) -> {
if (container instanceof TomcatEmbeddedServletContainerFactory) {
TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
tomcat.addConnectorCustomizers(
(connector) -> {
connector.setMaxPostSize(10000000);//10MB
}
);
}
};
}
@prashanth-g
Copy link

Thanks buddy 👍 Really helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment