The question I am asking could be really simple(even foolish).
I was using validation in spring-hibernate MVC app. I am using constraints such as @NotNull, @Pattern which come from javax.validation packages. When I us constraints such as @Email it is imported from org.hibernate.validator.constraints. In the validator class I use ValidatorFactory and other classes or interfaces(such as Validation, Validator) all of which are from javax.validation. I got really confused with this.
Then I started going deeper into what exactly javax validator and hibernate validator packages are, and apparently they are implementations of JSR303.
To validate, I use
ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
To further confuse me, I read one more way of instantiating ValidatorFactory which goes like this -
ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class).configure().buildValidatorFactory();
and it works fine!
Please help me understand both of these better.
Thanks for help.