Home > Back-end >  Spring fegin the return value of the transformation problem
Spring fegin the return value of the transformation problem

Time:11-19

 

@ GetMapping ("/test/getById/{id} ")
CommonResult LoadUserByUsername (@ PathVariable Integer id (" id "));


I want to return to the Test class directly, but the producer of the return value is CommonResult Can appear, if use AOP class conversion errors
 

@ GetMapping ("/test/getById/{id} ")
Test loadUserByUsername (@ PathVariable Integer id (" id "));


Producers code
 
@ ApiOperation (by id "query")
@ GetMapping ("/getById/{id} ")
Public CommonResult GetById (@ PathVariable Integer id (" id ")) {
Return CommonResult. Success (testService. GetById (id));
}

CodePudding user response:

Then use CommonResult Not line?

CodePudding user response:

Remote feign call, return parameter must agree, you can get the data, then wrapped up

CodePudding user response:

CommonResult should be defined by a common generics, inside there must be some way out data, you take the Test
  • Related