@RequestMapping(value = "/endpoint", method = RequestMethod.POST)
public ResponseEntity<?> endpoint(@RequestBody final ObjectNode data, final HttpServletRequest request) {
somefunction();
return new ResponseEntity<>(HttpStatus.OK);
}
public somefunction() {
.....
}
在Java彈簧控制器中,我有一個端點。當這個端點被調用時,我希望它直接返回,不要等到somefunction()
完成。任何人都可以教我如何處理這個問題?如何讓Java rest api調用立即不返回等待?
啓動'somefunction()'在其他'thread'上 – Jerry06
RxJava用於那個 – xenteros