code: public static Object invoke(ApplicationContext context, String beanName,
  			MethodInfo methodInfo, final Object[] params) throws IllegalArgumentException,
  			IllegalAccessException, InvocationTargetException {
  		Object bean = context.getBean(beanName);
  
  		Method handlerMethod = methodInfo.getMethod();
  		ReflectionUtils.makeAccessible(handlerMethod);
  		Object result = handlerMethod.invoke(bean, params);
  
  		if (result != null && result instanceof Optional) {
  			return ((Optional<?>) result).orElse(null);
  		}
  
  		return result;
  	}
docs: Invokes a method on a Spring managed bean.
  
  @param context a Spring application context
  @param beanName the name of the bean
  @param methodInfo the methodInfo object
  @param params the parameters
  @return the result of the method invocation
  @throws IllegalArgumentException if there is no bean in the context
  @throws IllegalAccessException
  @throws InvocationTargetException