You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@Profile mishandles "not" operand mixed with "&" [SPR-17606] #22138
I encountered strange bug with regard to handling of Profile conditions and active profiles. Below is a table describing tested combinations and expected results
@Profile value
Active profiles
Expected result
Actual result
!a & b
b
true
true
b & !a
b
true
true
!a & b
a
false
true
b & !a
a
false
false
!a & b
ab
false
false
b & !a
ab
false
false
As shown in the table above, test notAandBShouldNotAcceptWhenAActive should not accept the bean, but it does, and just different order of operations in @Profile is enough to behave accordingly. Tests were performed on JDK8. I created simple project to verify it and linked it with this issue.
Stéphane Nicoll, Phil Webb, could you have a look at the associated pull request, please? It generally looks sensible to me; I'm just wondering whether I'm missing some original design decision in the profiles expression support...
Activity
spring-projects-issues commentedon Jan 7, 2019
Juergen Hoeller commented
Stéphane Nicoll, Phil Webb, could you have a look at the associated pull request, please? It generally looks sensible to me; I'm just wondering whether I'm missing some original design decision in the profiles expression support...
spring-projects-issues commentedon Jan 8, 2019
Juergen Hoeller commented
Merged into master now. Thanks for the pull request!
If there is anything to follow up on, let's do it on master directly.