ConditionalOnProfile class

Marks a class or method to be included only when specific profiles are active.

This is useful for registering pods or configuration only in certain environments such as dev, test, or prod.

Example

@ConditionalOnProfile(['dev', 'local'])
class DevConfig {}

If none of the specified profiles are active, the pod or class will be skipped.

Profile activation is typically controlled via Environment.activeProfiles.

Annotations
  • @Conditional([ClassType<OnProfileCondition>()])
  • @Target.new({TargetKind.classType, TargetKind.method})

Constructors

ConditionalOnProfile(List<String> value)
Marks a class or method to be included only when specific profiles are active.
const

Properties

annotationType Type
Returns the annotation _type of this annotation.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value List<String>
The set of profiles for which the annotated component should be registered.
final

Methods

equalizedProperties() List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
equals(Object other) bool
Checks whether the given object is logically equivalent to this annotation.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns a string representation of this annotation.

Operators

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