code: @Validate
      public Validator initialize() {
          // configure and build an instance of ValidatorFactory
          ProviderSpecificBootstrap<HibernateValidatorConfiguration> validationBootStrap = javax.validation.Validation
                  .byProvider(HibernateValidator.class);
  
          // bootstrap to properly resolve in an OSGi environment
          validationBootStrap.providerResolver(new HibernateValidationProviderResolver());
  
          HibernateValidatorConfiguration configure = validationBootStrap.configure().messageInterpolator(interpolator);
          interpolator.setDefaultInterpolator(configure.getDefaultMessageInterpolator());
  
          // now that we've done configuring the ValidatorFactory, let's build it
          ValidatorFactory validatorFactory = configure.buildValidatorFactory();
  
          // retrieve a unique validator.
          Validator validator = validatorFactory.getValidator();
  
          // Register the validator.
          if (context != null) {
              registration = context.registerService(Validator.class, new WrappedValidator(validator), null);
              factoryRegistration = context.registerService(ValidatorFactory.class, validatorFactory, null);
          }
  
          return validator;
      }
docs: Initializes the validator, and registers it as an OSGi service (if the bundle context is set).
  
  @return the validator.