Home >Java >javaTutorial >SpringBoot sets interface timeout
SpringBoot has two ways to set the interface access timeout period
1. Add it to the configuration file application.properties Spring.mvc.async.request-timeout=20000, which means setting the timeout to 20000ms or 20s,
Second, there is another way to add:
public class WebMvcConfig extends WebMvcConfigurerAdapter { @Override public void configureAsyncSupport(final AsyncSupportConfigurer configurer) { configurer.setDefaultTimeout(20000); configurer.registerCallableInterceptors(timeoutInterceptor()); } @Bean public TimeoutCallableProcessingInterceptor timeoutInterceptor() { return new TimeoutCallableProcessingInterceptor(); } }to the config configuration class
The above is the detailed content of SpringBoot sets interface timeout. For more information, please follow other related articles on the PHP Chinese website!