ConditionalOnMissingPod constructor
const
ConditionalOnMissingPod({})
An annotation that activates a component only when specific pods are absent from the ConditionalContext.
This enables fallback configuration or alternative service definitions when certain pods are not registered.
Each pod may be referenced by type, qualified name, or pod name. Additionally, the ignoredTypes list can be used to exclude certain pod types from absence checks.
Example
@ConditionalOnMissingPod(
values: [ClassType<Database>(), 'cacheService'],
ignoredTypes: [ClassType<Logger>()],
)
class FallbackConfig {}
The above activates only if:
- Neither
Databasenor a pod namedcacheServiceexist, - And the
Loggerpod is ignored during evaluation.
Related:
Implementation
const ConditionalOnMissingPod({this.values = const [], this.ignoredTypes = const []});