当我使用 AsyncRestTemplate 的删除功能时,我从 ListenableFutureCallback 获取对象时遇到问题。这是我的源代码:
ListenableFutureCallback<Object> callbackDelete = new ListenableFutureCallback<Object>() {
@Override
public void onFailure(Throwable ex) {
logger.error("Error processing the delete request: " + ex.getMessage());
}
@Override
public void onSuccess(Object result) {
System.out.println("Async Delete Success : " + result.toString() );
logger.debug("The request has been processed successfully");
}
};
ListenableFuture<?> response = asyncRestTemplate.delete(DELETE_URL + "/" + id);
response.addCallback(callbackDelete);
当我执行 result.toString() 时,结果始终为空。
谢谢