ConditionGroup class
The conditions of one configuration class, decided once for the whole class, so that the class is registered all or nothing.
A class's conditions also guard its @Bean methods, its @Imports,
the classes it imports and its @PropertySources. Without the group, a
class condition such as "no Foo bean yet" would be checked again for
every @Bean method, and would drop the methods that come after the
class's own Foo. The group is decided once per ConfigurationPhase,
as Spring decides per class.
The generator wraps class conditions in a group keyed by the class; write one only for hand-written definitions that belong together.
// The class and its cache bean: both or neither.
const group = ConditionGroup('package:app/cache.dart#CacheConfig', [
OnMissingCache(),
]);
BeanDefinition<CacheConfig>(
name: 'cacheConfig',
conditions: const [group],
...,
);
BeanDefinition<Cache>(name: 'cache', conditions: const [group], ...);
Spring (Java): ConditionEvaluator tracking configuration classes.
- Implemented types
Constructors
-
ConditionGroup(String key, List<
Condition> conditions) -
Groups
conditionsunderkey, usuallylibrary#Class.const
Properties
-
conditions
→ List<
Condition> -
The conditions of the class; all must match.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → String
-
Identifies the group within one refresh; the cached decision and the
report entries are stored under it.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
matches(
ConditionContext context) → bool -
Whether the annotated bean should be registered;
contextgives access to the configuration and the definitions registered so far.override -
matchesIn(
ConditionContext context, ConfigurationPhase phase) → bool -
Whether the conditions that count in
phaseall match (see conditionsMatch); decided once per phase. -
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