How to check two condition while using @ConditionalOnProperty or @ConditionalOnExpression

Since from the beginning of @ConditionalOnProperty it was possible to check more than one property. The name / value attribute is an array.

@Configuration
@ConditionalOnProperty({ "property1", "property2" })
protected static class MultiplePropertiesRequiredConfiguration {

    @Bean
    public String foo() {
        return "foo";
    }

}

For simple boolean properties with an AND check you don’t need a @ConditionalOnExpression.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)