code: public <T> void validate(T configurationBean, Class<T> type) {
      LOG.debug("Validating configuration bean of type " + type);
  
      for (Method declaredMethod : type.getDeclaredMethods()) {
        try {
          LOG.debug("Validating method: " + declaredMethod.getName());
  
          declaredMethod.invoke(configurationBean);
  
        } catch (InvocationTargetException e) {
  
          if (e.getCause() != null) {
            if (e.getCause() instanceof NoSuchElementException) {
              throw (NoSuchElementException) e.getCause();
            }
  
            if (e.getCause() instanceof IllegalArgumentException) {
              throw (IllegalArgumentException) e.getCause();
            }
          }
  
          throw new IllegalStateException("Can't bind method " + declaredMethod.getName(), e);
  
        } catch (IllegalAccessException e) {
          throw new IllegalStateException("Can't bind method " + declaredMethod.getName(), e);
        }
      }
    }
docs: Validate if the {@code configurationBean} object was bound successfully
  
  @param configurationBean configurationBean to validate
  @param type              interface used to access {@code configurationBean}
  @param <T>               type of the validated bean
  @throws IllegalStateException    when unable to access one of the methods
  @throws NoSuchElementException   when an invocation of one of the {@code configurationBean} methods failed with an
  underlying exception of type {@link NoSuchElementException}
  @throws IllegalArgumentException when an invocation of one of the {@code configurationBean} methods failed with an
  underlying exception of type {@link IllegalArgumentException}