@Validated注解
- 修饰controller的入参参数上
- 入参参数内部使用其他细节注解进行判断
看样例
@ApiOperation(value = "添加修改ump告警规则")
@PostMapping("config")
public Result saveOrUpdateConfig(@Validated @RequestBody RadarScreenUmpConfig config){
radarScreenUmpService.saveOrUpdateConfig(config);
return success("修改成功");
}
参数定义
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class RadarScreenUmpConfig {
@NotEmpty(message = "umpKeys字段不能为空")
private List<String> umpKeys;
private List<RadarScreenUmpMetricConfig> alarmConfigs;
}
标签:saveOrUpdateConfig,private,使用,注解,Validated,config,public
From: https://www.cnblogs.com/PythonOrg/p/17440275.html