您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

SpringBoot设置接口超时时间

2024/5/2 14:43:41发布119次查看
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设置接口超时时间的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product