使用多線程處理邏輯

@GetMapping("/order")
public Callable order(){
Callable callable = new Callable() {
@Override
public UserTest call() throws Exception {
logger.info(“副線程開始”);
Thread.sleep(1000);
UserTest usr = new UserTest();
usr.setUsername(“1”);
usr.setPassword(“123”);
usr.setAge(11);
logger.info(“副線程結束”);
return usr;
}
};
return callable;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章