注解方式:(单用或者混用)
JSR和Hibernate validator的校验只能对Object的属性进行校验
spring validator添加了MethodValidationPostProcessor拦截器,可以实现对方法参数的校验
一、Spring Validator
'org.springframework.boot.spring-boot-starter-validation<'
二、Hibernate Validator
'javax.validation:validation-api:2.0.1.Final'
'org.hibernate.validator:hibernate-validator:6.0.16.Final'
https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/#preface
https://www.cnblogs.com/albert1024/articles/8436270.html
可用:https://www.jianshu.com/p/ca0bac07f473 ——接口方法的参数添加 @Valid,接口实现类添加 @Validated,需要校验的实体类参数上添加注解
注:
spring boot自定义注解+AOP拦截:https://blog.youkuaiyun.com/piaoranyuji/article/details/89448632
注解解释比较全:https://blog.youkuaiyun.com/HunterUUU/article/details/85253408
示例看着不错的:https://blog.youkuaiyun.com/steven2xupt/article/details/87452664
https://blog.youkuaiyun.com/justry_deng/article/details/86571671
写的比较乱,但也算是全的,不过尽量不要看这个吧,难受:https://www.cnblogs.com/cjsblog/p/8946768.html