简体   繁体   English

使用Spring Profiles的布尔表达式

[英]Boolean expression using Spring Profiles

We have the following annotation for a Component in a project: 我们对项目中的Component有以下注释:

@Profile("!department")

This means run this component when department is not an active profile. 这意味着当部门不是活动配置文件时运行此组件。 However, can you do something like: 但是,你可以这样做:

@Profile("!department" || "datamigration" ) OR @Profile("!department" || "datamigration" )

 @Profile(["!department","datamigration"] )

Basically I want a way to be able to say, use this Component if: 基本上我想要一种方法可以说,如果出现以下情况,请使用此Component

  • profile is NOT department 个人资料不是部门
    • OR 要么
  • profile is datamigration 个人资料是数据迁移

这应该足够了

@Profile({"!department","datamigration"})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM