code: public static void validateReturnType(Method method, Class<? extends Annotation> annotationType,
                                            Class<?> expectedReturnType) {
          if (!method.getReturnType().equals(expectedReturnType)) {
              throw new BeanCreationException("Method " + method.getName() + " annotated with @"
                    + annotationType.getName() + " must have a return type of "
                    + expectedReturnType.getName());
          }
      }
docs: Validates that the method annotated with the specified annotation returns
  the expected type.