validator的初始化

来源:3-13 优化校验规则

慕慕7439082

2019-08-12 20:09

@Override
public void afterPropertiesSet() throws Exception {
    //将hibernate validator通过工厂的初始化方法使其实例化
    this.validator= Validation.buildDefaultValidatorFactory().getValidator();
}

为什么要通过这种方法实现而不是直接自动注入@Autowired?

写回答 关注

0回答

还没有人回答问题,可以看看其他问题

SpringBoot构建电商基础秒杀项目

应用SpringBoot快速搭建拥有用户、商品、交易及秒杀活动的电商秒杀应用。

49546 学习 · 978 问题

查看课程

相似问题