@Validate框架使用异常

最近在需求code中,在调用一个项目中的方法,一直报如下错,百思不得其解。

HV000151: A method overriding another method must not alter the parameter constraint configuration, but method public int com.xxxx.service.xxxx.impl.xxxfundInfoServiceImpl.
updateXXXStatus(java.lang.Long,java.lang.Long,java.lang.Integer,java.lang.Integer) changes the configuration of public abstract int com.xxxx.service.xxxx.impl.xxxfundInfoServiceImpl.
updateXXXStatus(java.lang.Long,java.lang.Long,java.lang.Integer,java.lang.Integer).

方法定义及实现如下:

int updateXXXStatus(@NotNull Long pId, @NotNull Long orderNo, @NotNull Integer oldStatus, @NotNull Integer newStatus);

 

 public int updateXXXStatus(Long pId, Long orderNo, @NotNull Integer oldStatus, @NotNull Integer newStatus) {
     。。。。。。。。。。

     。。。。。。。。。。

}

经过反复检查对比,发现这个面向接口的编程接口使用的validate注解了,而实现方法中确没有加。

这样解决方法就比较简单了,

   1、定义和实现的方法参数都加一样的validate注解

   2、定义和实现的方法参数都去掉validate注解

   3、定义中不设置,只实现方法中参数有, 有时候有问题

posted @   xuzhujack  阅读(3567)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
;
点击右上角即可分享
微信分享提示