Skip to content

Support AND operator in yml profile matching #12469

Closed

Description

@twicksell

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

Activity

  1. added
    status: waiting-for-triage
    on Mar 13, 2018
  2. added
    type: enhancement
    and removed
    status: waiting-for-triage
    on Mar 13, 2018
  3. philwebb commented on Mar 19, 2018

    @philwebb
    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.

  4. added
    status: blocked
    and removed on Mar 19, 2018
  5. twicksell commented on Mar 27, 2018

    @twicksell
    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.

  6. philwebb commented on Mar 27, 2018

    @philwebb
    Member

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

  7. twicksell commented on Mar 27, 2018

    @twicksell
    Author

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

  8. removed
    status: blocked
    on Jun 15, 2018
  9. added this to the 2.1.0.M1 milestone on Jun 15, 2018
  10. self-assigned this
    on Jun 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions