Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boolean expression using Spring Profiles

Tags:

java

spring

We have the following annotation for a Component in a project:

@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"] )

Basically I want a way to be able to say, use this Component if:

  • profile is NOT department
    • OR
  • profile is datamigration
like image 452
Menelaos Avatar asked Jan 30 '23 05:01

Menelaos


1 Answers

This should be enough

@Profile({"!department","datamigration"})
like image 143
pvpkiran Avatar answered Feb 02 '23 10:02

pvpkiran