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

Viewed 48387

I need to check that two conditions are satisfied on a YAML property file, while creating a bean. How do I do that, as the @ConditionalOnProperty annotation supports only one property?

5 Answers
@ConditionalOnExpression("#{${path.to.property.one:true} and ${path.to.property.two:true}}")

both true values are the default value if property is not found.

Related