- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
May be implemented directly or, more usually, created using the
of(...) factory method.
- Phillip Webb, Sam Brannen
matchesTest if this
Profilesinstance matches against the given active profiles predicate.
activeProfiles- a predicate that tests whether a given profile is currently active
ofCreate a new
Profilesinstance that checks for matches against the given profile expressions.
The returned instance will match if any one of the given profile expressions matches.
A profile expression may contain a simple profile name (for example
"production") or a compound expression. A compound expression allows for more complicated profile logic to be expressed, for example
"production & cloud".
The following operators are supported in profile expressions.
!- A logical NOT of the profile name or compound expression
&- A logical AND of the profile names or compound expressions
|- A logical OR of the profile names or compound expressions
Please note that the
|operators may not be mixed without using parentheses. For example,
"a & b | c"is not a valid expression: it must be expressed as
"(a & b) | c"or
"a & (b | c)".
As of Spring Framework 5.1.17, two
Profilesinstances returned by this method are considered equivalent to each other (in terms of
hashCode()semantics) if they are created with identical profile expressions.
profileExpressions- the profile expressions to include
- a new