Class StandardBeanExpressionResolver
- java.lang.Object
- org.springframework.context.expression.StandardBeanExpressionResolver
- All Implemented Interfaces:
BeanExpressionResolver
public class StandardBeanExpressionResolver extends Object implements BeanExpressionResolver
Standard implementation of theBeanExpressionResolverinterface, parsing and evaluating Spring EL using Spring's expression module.- Since:
- 3.0
- Author:
- Juergen Hoeller
- See Also:
ExpressionParser,SpelExpressionParser,StandardEvaluationContext
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_EXPRESSION_PREFIXDefault expression prefix: "#{"static StringDEFAULT_EXPRESSION_SUFFIXDefault expression suffix: "}"
Constructor Summary
Constructors Constructor Description StandardBeanExpressionResolver()Create a newStandardBeanExpressionResolverwith default settings.StandardBeanExpressionResolver(ClassLoader beanClassLoader)Create a newStandardBeanExpressionResolverwith the given bean class loader, using it as the basis for expression compilation.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcustomizeEvaluationContext(StandardEvaluationContext evalContext)Template method for customizing the expression evaluation context.Objectevaluate(String value, BeanExpressionContext evalContext)Evaluate the given value as an expression, if applicable; return the value as-is otherwise.voidsetExpressionParser(ExpressionParser expressionParser)Specify the EL parser to use for expression parsing.voidsetExpressionPrefix(String expressionPrefix)Set the prefix that an expression string starts with.voidsetExpressionSuffix(String expressionSuffix)Set the suffix that an expression string ends with.
Field Detail
DEFAULT_EXPRESSION_PREFIX
public static final String DEFAULT_EXPRESSION_PREFIX
Default expression prefix: "#{"- See Also:
- Constant Field Values
DEFAULT_EXPRESSION_SUFFIX
public static final String DEFAULT_EXPRESSION_SUFFIX
Default expression suffix: "}"- See Also:
- Constant Field Values
Constructor Detail
StandardBeanExpressionResolver
public StandardBeanExpressionResolver()
Create a newStandardBeanExpressionResolverwith default settings.
StandardBeanExpressionResolver
public StandardBeanExpressionResolver(ClassLoader beanClassLoader)
Create a newStandardBeanExpressionResolverwith the given bean class loader, using it as the basis for expression compilation.- Parameters:
beanClassLoader- the factory's bean class loader
Method Detail
setExpressionPrefix
public void setExpressionPrefix(String expressionPrefix)
Set the prefix that an expression string starts with. The default is "#{".- See Also:
DEFAULT_EXPRESSION_PREFIX
setExpressionSuffix
public void setExpressionSuffix(String expressionSuffix)
Set the suffix that an expression string ends with. The default is "}".- See Also:
DEFAULT_EXPRESSION_SUFFIX
setExpressionParser
public void setExpressionParser(ExpressionParser expressionParser)
Specify the EL parser to use for expression parsing.Default is a
SpelExpressionParser, compatible with standard Unified EL style expression syntax.
evaluate
public Object evaluate(String value, BeanExpressionContext evalContext) throws BeansException
Description copied from interface:BeanExpressionResolverEvaluate the given value as an expression, if applicable; return the value as-is otherwise.- Specified by:
evaluatein interfaceBeanExpressionResolver- Parameters:
value- the value to checkevalContext- the evaluation context- Returns:
- the resolved value (potentially the given value as-is)
- Throws:
BeansException- if evaluation failed
customizeEvaluationContext
protected void customizeEvaluationContext(StandardEvaluationContext evalContext)
Template method for customizing the expression evaluation context.The default implementation is empty.