JSP EvalTag resolves "@myBeanName" references in expressions against the WebApplicationContext (SPR-7312); for consistency, expressions in an ApplicationContext support the same syntax against the local BeanFactory

This commit is contained in:
Juergen Hoeller
2010-07-12 19:36:26 +00:00
parent d1d5e2d52a
commit 263fabb0fc
6 changed files with 86 additions and 18 deletions

View File

@@ -17,20 +17,22 @@
package org.springframework.expression;
/**
* A bean resolver can be registered with the evaluation context and will
* A bean resolver can be registered with the evaluation context
* and will kick in for <code>@myBeanName</code> still expressions.
*
* @author Andy Clement
* @since 3.0.3
*/
public interface BeanResolver {
/**
* Lookup the named bean and return it.
* Look up the named bean and return it.
* @param context the current evaluation context
* @param beanname the name of the bean to lookup
* @return a object representing the bean
* @param beanName the name of the bean to lookup
* @return an object representing the bean
* @throws AccessException if there is an unexpected problem resolving the named bean
*/
Object resolve(EvaluationContext context, String beanname) throws AccessException;
Object resolve(EvaluationContext context, String beanName) throws AccessException;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,8 @@ import java.util.List;
public interface EvaluationContext {
/**
* @return the default root context object against which unqualified properties/methods/etc should be resolved. This can be overridden when evaluating an expression.
* @return the default root context object against which unqualified properties/methods/etc
* should be resolved. This can be overridden when evaluating an expression.
*/
TypedValue getRootObject();
@@ -68,13 +69,13 @@ public interface EvaluationContext {
TypeComparator getTypeComparator();
/**
* @return an operator overloader that may support mathematical operations between more than the standard set of
* types
* @return an operator overloader that may support mathematical operations
* between more than the standard set of types
*/
OperatorOverloader getOperatorOverloader();
/**
* @return a bean resolver that can lookup named beans
* @return a bean resolver that can look up beans by name
*/
BeanResolver getBeanResolver();