diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java index c0b49d25d78..938fa1c0142 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java @@ -32,6 +32,7 @@ import org.springframework.expression.spel.SpelMessage; * syntax {@code &orderServiceFactory} can be used to access the factory itself. * * @author Andy Clement + * @author Sam Brannen */ public class BeanReference extends SpelNodeImpl { @@ -46,6 +47,16 @@ public class BeanReference extends SpelNodeImpl { } + /** + * Get the name of the referenced bean. + * @return the name of the referenced bean, potentially prefixed with + * {@code &} for a direct reference to a {@code FactoryBean} + * @since 6.2 + */ + public final String getName() { + return this.beanName; + } + @Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { BeanResolver beanResolver = state.getEvaluationContext().getBeanResolver();