最近在需求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、定義中不設置,只實現方法中參數有, 有時候有問題