Java [dubbo rpc changed to feign call] controller annotation processing

dubbo rpc changed to feign, controller annotation processing


[Record of problem points in framework transformation, dubbo changed to spring cloud alibaba]
[Part 3] Controller annotation processing
[Description] Before the project, jboss was used, many ws.rs packages were introduced, and QueryParam was used for controller parameter annotation. During the transformation, it was replaced in batches with @RequestParam (representing must pass). But the front end will not pass all the parameters, it will cause 400, continuous update...

Controller

Without annotation, it means that it is optional (the default value is null):

@GetMapping("")
public ResultEntity functionName(String tenant);

Annotate the attribute to indicate that it is optional (the default value is null):

@GetMapping("")
public ResultEntity functionName(@RequestParam(required = false) String tenant);

Must pass:

@GetMapping("")
public ResultEntity functionName(@RequestParam String tenant);

Required, set the default value:

@GetMapping("")
public ResultEntity functionName(@RequestParam(defaultValue="") String tenant);

Guess you like

Origin blog.csdn.net/qq_16843563/article/details/131785767
Recommended