title: Configuring the validator provided to @Valid for message interpolation
body: <p>I'm using the hibernate validator:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dependency&gt;
    &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
    &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
    &lt;version&gt;5.1.2.Final&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>In my unit test, it works just fine using it this way:</p>
  
  <pre class="lang-java prettyprint-override"><code>  private static Validator validator;
  
    validator = ValidatorProvider.getInstance().getValidator();
  </code></pre>
  
  <p>with the validator being configured for message interpolation:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class ValidatorProvider {
  
      static ValidatorProvider INSTANCE;
      Validator validator;
  
      private ValidatorProvider() {
          CustomMessageInterpolator messageInterpolator = new CustomMessageInterpolator();
          ValidatorFactory validatorFactory
                  = Validation.byProvider(HibernateValidator.class).configure()
                  .messageInterpolator(messageInterpolator).buildValidatorFactory();
          validator = validatorFactory.getValidator();
      }
  
      public static ValidatorProvider getInstance() {
          if (INSTANCE == null) {
              INSTANCE = new ValidatorProvider();
          }
          return INSTANCE;
      }
  
      public Validator getValidator() {
          return validator;
      }
  }
  </code></pre>
  
  <p>The above singleton is not being used by the integration tests.</p>
  
  <p>Now, in my REST controller, I only have the @Valid annotation:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Valid Answer answer
  </code></pre>
  
  <p>For now, the following message:</p>
  
  <pre><code>javax.validation.constraints.Pattern.message=The "{0}" value must match "{regexp}".
  </code></pre>
  
  <p>is not interpolated when used in the integration test.</p>
  
  <p>How can I tell the above <code>@Valid</code> annotation that it should use my configured validator ?</p>