@RestController
@RequestMapping("/hello")
public class HelloController {
private ExecutorService service = Executors.newFixedThreadPool(10);
@GetMapping
public String hello() {
service.execute(new Runnable() {
@Override
public void run() {
try {
TimeUnit.SECONDS.sleep(3);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("我醒了");
}
});
return "hello world";
}
}