The default is 2000ms which isn't enough time for requests to complete cleanly in my application.
https://tomcat.apache.org/tomcat-8.5-doc/config/context.html
From Spring Booot 2, you can use:
@Bean
public ServletWebServerFactory servletWebServerFactory() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
tomcat.addContextCustomizers(context -> {
if(context instanceof StandardContext) {
((StandardContext)context).setUnloadDelay(8000);
}
});
return tomcat;
}
Before Spring Boot 2, this was different and you have to use a TomcatEmbeddedServletContainerFactory
instead of the TomcatServletWebServerFactory
and EmbeddedServletContainerFactory
instead of ServletWebServerFactory
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With