BeanFactoryAccessor class final

A PropertyAccessor that reads beans as properties of a BeanFactory itself, for expressions whose value is a bean factory (factory.mailer).

StandardBeanExpressionResolver registers it for @Value expressions. Beans cannot be assigned through it: writing throws an AccessException.

// The bean factory is the root: `mailer` is a bean.
final context = StandardEvaluationContext(beanFactory)
  ..addPropertyAccessor(const BeanFactoryAccessor());
SpelExpressionParser().parseExpression('mailer').getValue(context);

Spring (Java):

context.addPropertyAccessor(new BeanFactoryAccessor());
parser.parseExpression("mailer").getValue(context);
Implemented types

Constructors

BeanFactoryAccessor()
Creates the accessor (stateless).
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

canRead(EvaluationContext context, Object target, String name) → bool
Whether this accessor handles reading property name of target; false lets the next accessor try. target is never null.
override
canWrite(EvaluationContext context, Object target, String name) → bool
Whether this accessor handles writing property name of target; return false for read-only properties.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(EvaluationContext context, Object target, String name) → Object?
The value of property name of target; only called after canRead returned true.
override
toString() → String
A string representation of this object.
inherited
write(EvaluationContext context, Object target, String name, Object? newValue) → void
Stores newValue in property name of target; only called after canWrite returned true.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited