Search in sources :

Example 1 with MethodBasedEvaluationContext

use of org.springframework.context.expression.MethodBasedEvaluationContext in project spring-framework by spring-projects.

the class EventExpressionEvaluator method createEvaluationContext.

/**
	 * Create the suitable {@link EvaluationContext} for the specified event handling
	 * on the specified method.
	 */
public EvaluationContext createEvaluationContext(ApplicationEvent event, Class<?> targetClass, Method method, Object[] args, BeanFactory beanFactory) {
    Method targetMethod = getTargetMethod(targetClass, method);
    EventExpressionRootObject root = new EventExpressionRootObject(event, args);
    MethodBasedEvaluationContext evaluationContext = new MethodBasedEvaluationContext(root, targetMethod, args, getParameterNameDiscoverer());
    if (beanFactory != null) {
        evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
    }
    return evaluationContext;
}
Also used : MethodBasedEvaluationContext(org.springframework.context.expression.MethodBasedEvaluationContext) BeanFactoryResolver(org.springframework.context.expression.BeanFactoryResolver) Method(java.lang.reflect.Method)

Aggregations

Method (java.lang.reflect.Method)1 BeanFactoryResolver (org.springframework.context.expression.BeanFactoryResolver)1 MethodBasedEvaluationContext (org.springframework.context.expression.MethodBasedEvaluationContext)1