@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、定义中不设置,只实现方法中参数有, 有时候有问题


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM