Introduce getName() in SpEL's BeanReference

Closes gh-32640
This commit is contained in:
Sam Brannen 2024-04-15 16:44:37 +02:00
parent 3f34a13436
commit afbce96fb7
1 changed files with 11 additions and 0 deletions

View File

@ -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();