Spring boot - @ConditionalOnProperty or @ConditionalOnExpression

前端 未结 4 1054
长情又很酷
长情又很酷 2021-02-05 07:17

I\'m using Spring-Boot-1.1.7. My intention is to add a bean to my context according to a value of a property of type string.

I mean, I can see a lot of examples of boole

4条回答
  •  一整个雨季
    2021-02-05 07:46

    Eventually , this one worked for me:

    @ConditionalOnExpression("'${server.host}'=='localhost'")
    

提交回复
热议问题