ConditionalOnProperty class
Register bean only if the specified property exists and matches the value
Example:
@Service()
@ConditionalOnProperty(
name: 'feature.email.enabled',
havingValue: 'true',
matchIfMissing: false
)
class EmailService {
// Only registered if feature.email.enabled=true
}
- Inheritance
-
- Object
- Conditional
- ConditionalOnProperty
Constructors
- ConditionalOnProperty({required String name, String havingValue = 'true', bool matchIfMissing = false})
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- havingValue → String
-
The expected value (default: 'true')
final
- matchIfMissing → bool
-
Whether to match if the property is missing (default: false)
final
- name → String
-
The property name to check
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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