@GetMapping("/test/getById/{id}")
CommonResult<Test> loadUserByUsername(@PathVariable("id") Integer id);
我想直接 回傳Test類,但是 生產者的回傳值 是 CommonResult<Test>,如果用AOP 會出現類轉換錯誤
@GetMapping("/test/getById/{id}")
Test loadUserByUsername(@PathVariable("id") Integer id);
生產者代碼
@ApiOperation("通過id查詢")
@GetMapping("/getById/{id}")
public CommonResult<Test> getById(@PathVariable("id") Integer id) {
return CommonResult.success(testService.getById(id));
}
uj5u.com熱心網友回復:
那就用CommonResult<Test> 不行嗎uj5u.com熱心網友回復:
遠程feign呼叫,回傳引數必須一致,你可以得到資料后,自己再封裝一下uj5u.com熱心網友回復:
CommonResult 應該是定義的一個通用泛型,里面肯定有方法取出data,你取出來就是Test轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/224559.html
標籤:Web 開發
