title: How to validate type 'java.lang.Boolean' in Spring boot
body: <p>I have a boolean field which I want to validate to have only "true" or "false" as value(without quotes). But this field is also allowing "true" or "false" as value(with quotes) which I want to restrict.</p>
  
  <p>I tried to use @Pattern annotation to match these values.
  But I have the following error:</p>
  
  <blockquote>
    <p>javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.Pattern' validating type 'java.lang.Boolean'. Check configuration for 'restartable'</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>@Pattern(regexp = "^(true|false)$", message = "restartable field allowed input: true or false")
  private Boolean restartable;
  </code></pre>
  
  <p>What should i do? Is there some other way to overcome this issue? Thanks in advance.</p>