Spring boot - @ConditionalOnProperty or @ConditionalOnExpression
Eventually , this one worked for me:
@ConditionalOnExpression("'${server.host}'=='localhost'")
For property value conditional I used:
@ConditionalOnProperty(name="server.host", havingValue="localhost")
If the value you want to compare with is a literal, you need to quote it, and the placeholder would go round the property name (not the whole expression), e.g. ${server.host}=='localhost'