Reputation: 3387
Given that I have the following properties:
values[0]=A
values[1]=B
values[2]=C
I need to check that values
contains A in a @ConditionalOnExpression
annotation. As of yet, I have not found an example of how to do it. I have tried this, but it does not work:
@ConditionalOnExpression("${values}.contains('A')")
It results in:
java.lang.IllegalStateException: Failed to load ApplicationContext
Upvotes: 4
Views: 3546
Reputation: 40008
You need $ expresion surrounded by single quotes
@ConditionalOnExpression("'${values}'.contains('A')")
Upvotes: 9