private ActionHandlerValidatorInstance createInstance(
      ActionHandlerValidatorClass<? extends Action<?>, ? extends Result>
          actionHandlerValidatorClass) {

    ActionHandlerValidatorInstance actionHandlerValidatorInstance = null;
    ActionValidator actionValidator =
        findActionValidator(actionHandlerValidatorClass.getActionValidatorClass());

    ActionHandler<?, ?> actionHandler =
        SpringUtils.getInstance(
            applicationContext, actionHandlerValidatorClass.getActionHandlerClass());

    if (actionValidator == null) {
      actionValidator =
          SpringUtils.getInstance(
              applicationContext, actionHandlerValidatorClass.getActionValidatorClass());
      actionHandlerValidatorInstance =
          new ActionHandlerValidatorInstance(actionValidator, actionHandler);

      validators.put(actionValidator.getClass(), actionValidator);
    } else {
      actionHandlerValidatorInstance =
          new ActionHandlerValidatorInstance(actionValidator, actionHandler);
    }

    if (actionHandlerValidatorInstance.getActionHandler() == null
        || actionHandlerValidatorInstance.getActionValidator() == null) {
      return null;
    }

    return actionHandlerValidatorInstance;
  }
  private boolean containValidator(ActionValidator actionValidator) {
    for (ActionHandlerValidatorInstance validator : actionHandlerValidatorInstances.values()) {
      if (validator.getActionValidator().getClass().equals(actionValidator.getClass())) {
        return true;
      }
    }

    return false;
  }
  @Override
  public <A extends Action<R>, R extends Result> void removeActionHandlerValidatorClass(
      Class<A> actionClass, ActionHandlerValidatorClass<A, R> actionHandlerValidatorClass) {

    ActionHandlerValidatorClass<?, ?> oldActionHandlerValidatorClass =
        actionHandlerValidatorClasses.get(actionClass);

    if (oldActionHandlerValidatorClass == actionHandlerValidatorClass) {
      actionHandlerValidatorClasses.remove(actionClass);
      ActionHandlerValidatorInstance instance = actionHandlerValidatorInstances.remove(actionClass);

      if (!containValidator(instance.getActionValidator())) {
        validators.remove(instance.getActionValidator().getClass());
      }
    }
  }