如何在RestController中设置Spring Boot的超时时间?

时间:2019-02-13 08:27:28

标签: spring-boot

我正在使用Spring Boot 2.0.6,我想为RestController设置超时。下面是我的代码,但似乎根本不起作用。在这种情况下有人会帮助我吗?非常感谢。

@RestController
public class TestController {

    @GetMapping("/test-rest")
    @Timed(millis = 1000)
    public HashMap<String, Object> index() {
        Thread.sleep(2000);
        HashMap<String, Object> result = new HashMap<>();
        return result;
    }
}

0 个答案:

没有答案