Annotation Interface Conditional


@Target({TYPE,METHOD}) @Retention(RUNTIME) public @interface Conditional
Activates the annotated component only if all given Conditions match.

Supported on services, Configuration classes, Bean methods, commands, tab completers and event listeners. Inactive services are ignored when discovering implementations, so several services can implement the same interface as long as only one of them is active.

 @Service
 @Conditional(EconomyEnabled.class)
 public class BuiltinEconomyService implements EconomyService { ... }
 
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Class<? extends Condition>[]
    The conditions that must all match.
  • Element Details

    • value

      Class<? extends Condition>[] value
      The conditions that must all match.