首頁  >  文章  >  Java  >  SpringBoot設定介面逾時時間

SpringBoot設定介面逾時時間

(*-*)浩
(*-*)浩轉載
2019-08-07 16:53:288144瀏覽

SpringBoot設定介面存取逾時時間有兩種方式

SpringBoot設定介面逾時時間

#一、在設定檔application.properties中加了spring.mvc.async.request-timeout=20000,意思是設定超時時間為20000ms即20s,

二、還有一種就是在config組態類別中加入:

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();
	}
}

以上是SpringBoot設定介面逾時時間的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:csdn.net。如有侵權,請聯絡admin@php.cn刪除
上一篇:自學java多久下一篇:自學java多久