关于A method overriding another method must not redefine the parameter constraint configuration解决方法

关于A method overriding another method must not redefine the parameter constraint configuration解决方法

  • 使用的@Validated校验参数接口参数和实现类参数要保持一直,不然会报错。
  • 接口:
1
2
3
4
5
6
7
8
@FeignClient(name = "enroll")
public interface EduBatchApi {
/**
* 获取招生批次详细信息
*
* @param id 主键
*/
R<EduBatchVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable String id);
  • 实现类
1
2
3
4
5
6
7
8
9
10
11
12
13
public class EduBatchController implements EduBatchApi {

private final IEduBatchService iEduBatchService;

/**
* 获取招生批次详细信息
*
* @param id 主键
*/
@GetMapping("/{id}")
public R<EduBatchVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable String id) {
return R.success(iEduBatchService.queryById(id));
}

关于A method overriding another method must not redefine the parameter constraint configuration解决方法
http://ysocket.pages.dev/2023/11/11/A-method-overriding-another-method-must-not-redefine-the-parameter-constraint-configuration/
作者
YSocket
发布于
20231111
许可协议