BeanExpressionContext class final

The root object of @Value('#{...}') expressions, whose properties are the beans of a bean factory.

It is why #{mailer.defaultSender} in an @Value reads the bean named mailer: unprefixed names are looked up on this root, and BeanExpressionContextAccessor answers them with beans. StandardBeanExpressionResolver creates it; applications only use it through those expressions. Two names are always present, unless beans with these names exist: systemEnvironment, the map of environment variables (of the environment bean when there is one), and systemProperties. Dart has no JVM system properties, so systemProperties is the map of --key=value command-line arguments (the commandLineArgs property source of the environment bean), which play the part of -Dkey=value; compile-time -D defines are constants and cannot be enumerated.

// What `#{mailer}` and `#{systemEnvironment['HOME']}` see.
final root = BeanExpressionContext(beanFactory);
root.containsObject('mailer'); // true when the bean exists
root.getObject('mailer'); // the bean, or null
root.getObject('systemEnvironment'); // {'HOME': ..., ...}
root.getObject('systemProperties'); // {'server.port': '9000', ...}

Spring (Java):

BeanExpressionContext root = new BeanExpressionContext(beanFactory, null);
Object mailer = root.getObject("mailer");

Constructors

BeanExpressionContext(BeanFactory beanFactory)
Exposes the beans of beanFactory.
const

Properties

beanFactory → BeanFactory
The factory whose beans are exposed.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

containsObject(String name) → bool
Whether a bean named name exists (always for systemEnvironment and systemProperties).
getObject(String name) → Object?
The bean named name, or null when there is none.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

systemEnvironmentBeanName → const String
Name of the environment-variable map (Spring's SYSTEM_ENVIRONMENT_BEAN_NAME).
systemPropertiesBeanName → const String
Name of the system-property map (Spring's SYSTEM_PROPERTIES_BEAN_NAME).