title: Bean validation fails for Spring Boot application
body: <p>I have a rest endpoint that is using javax validation with hibernate-validator.  </p>
  
  <pre><code>@PostMapping(path = "/send")
  public ResponseEntity&lt;?&gt; send(@Valid @RequestBody DisbursementProcessingDto processingDto,
                                    @RequestHeader(HttpHeaders.USER_AGENT) String userAgent, 
                                    @RequestHeader(name = X_REQUEST_ID, required = false) Optional&lt;String&gt; xRequestId,
                                    BindingResult bindingResult) {
  </code></pre>
  
  <p>the bean has the following validations</p>
  
  <pre><code>@NotNull(message = "A valid correlation Id must be provided.")
  private UUID correlationId;
  @NotNull(message = "A non null and postive amount is required")
  @Positive(message = "A non null and postive amount is required")
  private BigDecimal totalAmount;
  @NotNull(message = "A non null and postive count is required")
  @Positive(message = "A non null and postive count is required")
  private Long totalCount;
  </code></pre>
  
  <p>This end point executes if I take the Valid annotation off.
  but as soon as I add it I get the following:</p>
  
  <pre><code>Caused by: java.lang.NullPointerException: null
      at sun.reflect.annotation.TypeAnnotationParser.mapTypeAnnotations(TypeAnnotationParser.java:356)
      at sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl.&lt;init&gt;(AnnotatedTypeFactory.java:139)
      at sun.reflect.annotation.AnnotatedTypeFactory.buildAnnotatedType(AnnotatedTypeFactory.java:65)
      at sun.reflect.annotation.TypeAnnotationParser.buildAnnotatedType(TypeAnnotationParser.java:79)
      at java.lang.reflect.Field.getAnnotatedType(Field.java:1170)
      at org.hibernate.validator.internal.metadata.provider.TypeAnnotationAwareMetaDataProvider.findTypeAnnotationConstraintsForMember(TypeAnnotationAwareMetaDataProvider.java:65)
      at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.findPropertyMetaData(AnnotationMetaDataProvider.java:244)
      at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getFieldMetaData(AnnotationMetaDataProvider.java:227)
      at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.retrieveBeanConfiguration(AnnotationMetaDataProvider.java:137)
      at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getBeanConfiguration(AnnotationMetaDataProvider.java:125)
      at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getBeanConfigurationForHierarchy(AnnotationMetaDataProvider.java:108)
      at org.hibernate.validator.internal.metadata.BeanMetaDataManager.createBeanMetaData(BeanMetaDataManager.java:203)
      at org.hibernate.validator.internal.metadata.BeanMetaDataManager.getOrCreateBeanMetaData(BeanMetaDataManager.java:231)
      at org.hibernate.validator.internal.metadata.BeanMetaDataManager.isConstrained(BeanMetaDataManager.java:174)
      at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:195)
      at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:119)
      at org.springframework.boot.autoconfigure.web.WebMvcValidator.validate(WebMvcValidator.java:69)
      at org.springframework.validation.DataBinder.validate(DataBinder.java:892)
      at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.validateIfApplicable(AbstractMessageConverterMethodArgumentResolver.java:270)
      at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:133)
      at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121)
      at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:158)
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:128)
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
      ... 61 common frames omitted\n"}
  </code></pre>
  
  <p>I have other endpoints that are using validation that work but this endpoint is not.  I have been all over the web looking for some reason why this is happening and I'm coming up empty.  </p>