/**
* @Classname CallableController
* @Description TODO
* @Date 2020/11/22 17:33
* @Created by XinHai.Ma
*/
@RequestMapping("/callable")
@RestController
public class CallableController {
@RequestMapping(value = "/create", method = RequestMethod.GET)
public Callable<Map<String, Object>> createData() throws RuntimeException {
return new Callable<Map<String, Object>>() {
@Override
public Map<String, Object> call() throws Exception {
Map<String, Object> result = new HashMap<>();
result.put("code", 200);
result.put("message", "success");
return result;
}
};
}
}
就这么写,处理Callable的线程池就不用配置了