Spring - Multiple Profiles active

后端 未结 4 814
遇见更好的自我
遇见更好的自我 2020-12-24 08:08

I basically have a bean in Spring that I wanted to activate only when 2 profiles are active. Basically, it would be like:

@Profile({\"Tomcat\", \"Linux\"})
p         


        
4条回答
  •  旧巷少年郎
    2020-12-24 08:35

    @ConditionalOnExpression("#{environment.acceptsProfiles('Tomcat') && environment.acceptsProfiles('Linux')}")
    

    Credits: Spring Source Code. Look up the @ConditionalOnExpression with your IDE then 'find usages' to see relevant examples within the source code. This will enable you to become a better developer.

提交回复
热议问题