遇到HV000151-A method overriding another method must not redefine the parameter异常;
spring @validate
@Validated @Slf4j public class FaController { @PostMapping("/category") public Result<List<SecVo>> category( HttpServletRequest request) { // 使用fiegn来调用其他的服务,其他服务提供的接口又使用错误的使用@Validated的注解 // 导致服务提供方抛出此异常,而不是单体服务出的异常 return FiegnClient.restReq("/favorites/category");// 伪代码 } } // @FeignClient(value = "center-order", path = "favorites", fallback = FaApiFallBack.class) public interface FavoritesApi{ @PostMapping("/category") Result<List<SeVo>> category(@RequestParam("uid")Long uid); } // @Api("-清单") @RestController @RequestMapping("/favorites") @Validated public class FaController implements FaApi{ @ApiOperation("清单分类") @PostMapping("/category") public Result<List<SeVo>> category(@NotNull @RequestParam("fuid")Long fuid) { return Result.success(faService.getCategory(fuid)); } }
引发的
HV000151: A method overriding another method must not redefine the parameter constraint configuration, but method FaController #category(FaDto) redefines the configuration of FaApi#category(FaDto).”
解决方法:去掉controller 上的 implements FaApi 即可;
其他可能引起的是 interface 与impl的 @Validate的注解不一致;可自行baidu
0 条评论