Spring @Validate 报 :"No validator could be found for type: java.lang.Long" 异常

项目环境:SpringMVC Controller 层接口 入参添加 @Validate 校验入参非空 。 当我用postman 发起http请求时,传入的参数没有问题,但是spring却抛出上面的错误。


解决方案:

                原来 对于Long  类型判空 需要用@NotNull 而不是 @NotBlank或者@NotEmpty 否则会报上述错误

猜你喜欢

转载自blog.csdn.net/liuming134/article/details/80567377