@PostConstruct public void init(){
  Iterator<ValidatorFactory> iterator=validatorFactoryInstance.iterator();
  if (iterator.hasNext()) {
    this.validatorFactory=iterator.next();
  }
 else {
    log.warning("Creating a ValidatorFactory because the container didn't provide one!");
    this.validatorFactory=Validation.buildDefaultValidatorFactory();
  }
}

@ PostConstruct public void init ( ) { Iterator < ValidatorFactory > iterator = validatorFactoryInstance . iterator ( ) ; if ( iterator . hasNext ( ) ) { this . validatorFactory = iterator . next ( ) ; } else { log . warning ( "Creating a ValidatorFactory because the container didn't provide one!" ) ; this . validatorFactory = Validation . buildDefaultValidatorFactory ( ) ; } }
we should be able to get a validatorfactory from the container in an java ee environment . however , if we don ' t get the factory , we will will use a default one . this is especially useful for non java ee environments and in the cdi tests
