The Java EE platform spec states (EE.5.17):{{ "In order to customize the returned ValidatorFactory , an EJB, web or application client module may specify a Bean Validation XML deployment descriptor. The name of the descriptor is WEB-INF/validation.xml for web modules and META-INF/validation.xml for all other types of modules. A validation deployment descriptor only affects ValidatorFactory instances in that module. There is no per-application validation deployment descriptor."}}
(EE.5.17.2) {{"The Java EE Product Provider must make a default ValidatorFactory available at java:comp/ValidatorFactory . The default ValidatorFactory available at java:comp/ValidatorFactory must support use of CDI if CDI is enabled for the module." }} "The default ValidatorFactory is a single instance per module; each lookup of java:comp/ValidatorFactory returns the same instance. The default Validator is created by the default ValidatoryFactory using the getValidator method. Each lookup of java:comp/Validator returns a new Validator instance."
However, the ValidatorBean and ValidatorFactoryBean provided by hibernate-validator-cdi are both ApplicationScoped which makes the per module behavior mentioned above not possible.
|