Skip to content

Support AND operator in yml profile matching #12469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
twicksell opened this issue Mar 13, 2018 · 4 comments
Closed

Support AND operator in yml profile matching #12469

twicksell opened this issue Mar 13, 2018 · 4 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@twicksell
Copy link

twicksell commented Mar 13, 2018

Similar to https://jira.spring.io/browse/SPR-12458, we would like ability for the yaml profile matching to follow AND semantics instead of OR.

To disambiguate from the current behavior and not create a behavior change, it may be helpful to introduce a new name. Something like:

---
spring.allProfiles: profile1, profile2  #would like these applied only when both profiles are set
someProp: someValue
@philwebb
Copy link
Member

In 2.0 we changed the way that YAML profiles are handled. We now delegate to Environment.acceptsProfiles to determine when the document is include. I think as a result of this change, if SPR-12458 is fixed then Boot should just work.

I'll leave this one open since we should add some tests, but getting SPR-12458 fixed should be the priority.

@philwebb philwebb added status: blocked An issue that's blocked on an external project change and removed for: team-meeting labels Mar 19, 2018
@twicksell
Copy link
Author

My current interpretation of the proposed fix for SPR-12458 is that it would not change the behavior of Environment.acceptsProfiles, but instead introduce a new annotation pattern to get the AND behavior. But perhaps I'm missing some context that didn't make it into the ticket. That is what led me to opening this issue and proposing a key like spring.allProfiles as an analogue to the suggested @Profiles approach in SPR-12458. If I understand correctly, boot will need more than a test case.

I'd be happy to submit a PR for that work, just waiting to hear from either ticket what the accepted solution should be.

@philwebb
Copy link
Member

I missed the JIRA update from May 7. I've added a comment to the Spring issue

@twicksell
Copy link
Author

Thanks, I also wouldn't oppose the p2+p3 approach FWIW. Appreciate your help with this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants