Skip to content

Commit afbce96

Browse files
committed
Introduce getName() in SpEL's BeanReference
Closes gh-32640
1 parent 3f34a13 commit afbce96

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
* syntax {@code &orderServiceFactory} can be used to access the factory itself.
3333
*
3434
* @author Andy Clement
35+
* @author Sam Brannen
3536
*/
3637
public class BeanReference extends SpelNodeImpl {
3738

@@ -46,6 +47,16 @@ public BeanReference(int startPos, int endPos, String beanName) {
4647
}
4748

4849

50+
/**
51+
* Get the name of the referenced bean.
52+
* @return the name of the referenced bean, potentially prefixed with
53+
* {@code &} for a direct reference to a {@code FactoryBean}
54+
* @since 6.2
55+
*/
56+
public final String getName() {
57+
return this.beanName;
58+
}
59+
4960
@Override
5061
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException {
5162
BeanResolver beanResolver = state.getEvaluationContext().getBeanResolver();

0 commit comments

Comments
 (0)