admin管理员组

文章数量:1794759

spring.mvc.async.request

spring.mvc.async.request

配置 spring.mvc.async.request-timeout=20000

代码 @GetMapping("test") public String test(){ try { Thread.sleep(60000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("keep going"); return "success"; } @GetMapping("test2") public Callable<String> test2() { return ()-> { try { Thread.sleep(60000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("keep going"); return "foobar"; }; } 解析

test不生效  test2生效

看看解释,异步请求到达之前的时间量 

当20秒到了,程序睡眠中断。实际就是程序直接跳出

返回503 

 

本文标签: MVCspringrequestasync