title: Unknown property error while using BeanUtils.getProperty()
body: <p>Here's my class. </p>
  
  <pre><code>@DateRange.List({
          @DateRange(start = "startDate", end = "endDate", message = "Start date should be earlier than end date.")
  })
  public class MyClass {
      @NotNull
      @Pattern(regexp = DateConstants.DATE_FORMAT_REGEX, message = "Invalid date format.")
      public String startDate;
  
      @NotNull
      @Pattern(regexp = DateConstants.DATE_FORMAT_REGEX, message = "Invalid date format.")
      public String endDate;
  }
  </code></pre>
  
  <p>I've added a <code>@DateRange</code> annotation, which is declared as follows. </p>
  
  <pre><code>@Target({TYPE, ANNOTATION_TYPE})
  @Retention(RUNTIME)
  @Constraint(validatedBy = DateRangeValidator.class)
  @Documented
  public @interface DateRange {
      String message() default "{constraints.daterange}";
  
      Class&lt;?&gt;[] groups() default {};
  
      Class&lt;? extends Payload&gt;[] payload() default {};
  
      String start();
  
      String end();
  
      @Target({TYPE, ANNOTATION_TYPE})
      @Retention(RUNTIME)
      @Documented
      @interface List {
          DateRange[] value();
      }
  }
  </code></pre>
  
  <p>And the validator class is</p>
  
  <pre><code>public class DateRangeValidator implements ConstraintValidator&lt;DateRange, Object&gt; {
      private String startDateFieldName;
      private String endDateFieldName;
  
      @Override
      public void initialize(final DateRange constraintAnnotation) {
          startDateFieldName = constraintAnnotation.start();
          endDateFieldName = constraintAnnotation.end();
      }
  
      @Override
      public boolean isValid(final Object value, final ConstraintValidatorContext context) {
  
          final String startDate = (String) BeanUtils.getProperty(value, startDateFieldName);
          final String endDate = (String) BeanUtils.getProperty(value, endDateFieldName);
  
          return isValidDateRange(startDate, endDate);
      }
  
      private boolean isValidDateRange(String start, String end) {
          DateFormat dateFormat = new SimpleDateFormat(DateConstants.DATE_FORMAT);
          try {
              Date startDate = dateFormat.parse(start);
              Date endDate = dateFormat.parse(end);
  
              if (startDate.before(endDate)) return true;
          } catch (ParseException e) {}
  
          return false;
      }
  }
  </code></pre>
  
  <p>The validator checks if the start date is before the end date. </p>
  
  <p>While doing so, the <code>BeanUtils.getProperty()</code> is throwing <code>java.lang.NoSuchMethodException</code> along with <code>Unknown property 'startDate'</code>. </p>
  
  <pre><code>java.lang.NoSuchMethodException: Unknown property 'startDate' on class 'class mypackage.domain.rest.MyClass'
      at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1322)
      at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:770)
      at org.apache.commons.beanutils.BeanUtilsBean.getNestedProperty(BeanUtilsBean.java:715)
      at org.apache.commons.beanutils.BeanUtilsBean.getProperty(BeanUtilsBean.java:741)
      at org.apache.commons.beanutils.BeanUtils.getProperty(BeanUtils.java:382)
      at bd.com.ipay.offer.validation.imp.DateRangeValidator.isValid(DateRangeValidator.java:36)
      at org.hibernate.validator.engine.ConstraintTree.validateSingleConstraint(ConstraintTree.java:278)
      at org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:153)
      at org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:117)
      at org.hibernate.validator.metadata.MetaConstraint.validateConstraint(MetaConstraint.java:84)
      at org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:452)
      at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:397)
      at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:361)
      at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:313)
      at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:139)
      at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:108)
      at org.springframework.validation.DataBinder.validate(DataBinder.java:866)
      at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.validateIfApplicable(AbstractMessageConverterMethodArgumentResolver.java:268)
      at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:130)
      at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:99)
      at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:161)
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:128)
  </code></pre>
  
  <p>But the <code>startDate</code> is there in <code>MyClass</code>. The variable is public and named camel case. Why the problem is occurring? Any idea? </p>