Annotation Interface ConditionalOnMissingProperty


@Target({METHOD,TYPE}) @Retention(RUNTIME) @Conditional(ConditionalOnMissingProperty.Condition.class) public @interface ConditionalOnMissingProperty
Conditional that only matches when the specified property is either unset or the empty string.

This can be used to register default behavior when configuration is absent.

Usage

@ConditionalOnMissingProperty("custom.datasource.url")
@Bean
public DataSource defaultDataSource() {
    return new H2DataSource();
}
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Returns the application property key that must be absent or have an empty string value for this condition to match.
  • Element Details

    • value

      String value
      Returns the application property key that must be absent or have an empty string value for this condition to match.