Annotation Interface ConditionalOnProperty
@Target({METHOD,TYPE})
@Retention(RUNTIME)
@Conditional(Condition.class)
public @interface ConditionalOnProperty
Conditional
that only matches when a specific property is set and matches a given pattern.
Usage
@ConditionalOnProperty(value = "feature.enabled")
@Bean
public FeatureService featureService() {
return new FeatureService();
}
The pattern is a regular expression (defaults to ".+"
, i.e., non-empty).
-
Nested Class Summary
Nested Classes -
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements