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

Add array support for spring.profiles.include. #6995

Closed
tokuhirom opened this Issue Sep 22, 2016 · 3 comments

Comments

Projects
None yet
5 participants
@tokuhirom

tokuhirom commented Sep 22, 2016

I'm writing my configuration file like following:


---
spring.profiles: default
spring.profiles.active: local

---
spring.profiles.include: "\
  logging-devel,\
  mybatis-common,\
  freemarker-devel,\
  freemarker-common
"

---
spring.profiles: release
spring.profiles.include: "\
  mybatis-common,\
  freemarker-release,\
  freemarker-common
"

But this style is hackish. I want to write my configuration in following style:


---
spring.profiles: default
spring.profiles.active: local

---
spring.profiles.include:
  - logging-devel
  - mybatis-common
  - freemarker-develo
  - freemarker-common

---
spring.profiles: release
spring.profiles.include:
  - mybatis-common
  - freemarker-release
  - freemarker-common
@snicoll

This comment has been minimized.

Show comment
Hide comment
@snicoll

snicoll Sep 28, 2016

Member

spring.profiles.include is a java.lang.String in the meta-data so it makes sense that you can't write it that way. But I guess it would be better if it was a list indeed.

Member

snicoll commented Sep 28, 2016

spring.profiles.include is a java.lang.String in the meta-data so it makes sense that you can't write it that way. But I guess it would be better if it was a list indeed.

@nathansgreen

This comment has been minimized.

Show comment
Hide comment
@nathansgreen

nathansgreen Nov 15, 2016

Will this cover the following case?

spring:
  profiles: [ default, develop ]

This is more intuitive than having to use 'default,develop', which will fail if there's whitespace after the comma.

nathansgreen commented Nov 15, 2016

Will this cover the following case?

spring:
  profiles: [ default, develop ]

This is more intuitive than having to use 'default,develop', which will fail if there's whitespace after the comma.

@wilkinsona

This comment has been minimized.

Show comment
Hide comment
@wilkinsona

wilkinsona Nov 15, 2016

Member

@nathansgreen No, this issue is specifically about spring.profiles.include. The associated PR (#7175) also covers spring.profiles.active. A separate change would have to be made (to SpringProfileDocumentMatcher, I believe) to allow a list to be used when configuring spring.profiles. If that's something you'd like to see, please open a separate issue.

Member

wilkinsona commented Nov 15, 2016

@nathansgreen No, this issue is specifically about spring.profiles.include. The associated PR (#7175) also covers spring.profiles.active. A separate change would have to be made (to SpringProfileDocumentMatcher, I believe) to allow a list to be used when configuring spring.profiles. If that's something you'd like to see, please open a separate issue.

@wilkinsona wilkinsona self-assigned this Nov 22, 2016

wilkinsona added a commit that referenced this issue Nov 25, 2016

Use data binding to access spring.profiles .active and .include
Previously, spring.profiles.active and spring.profiles.include were
looked up manually. This meant that configuration that used indexes
(for example spring.profiles.active[0]=dev) were not bound. As a
result, YAML lists did not work.

This commit updates ConfigFileApplicationListener to use a
RelaxedDataBinder to retrieve the values of spring.profiles.active
and spring.profiles.include, thereby reusing the data binding logic
that supports property names with indexes.

See gh-6995

@wilkinsona wilkinsona modified the milestones: 1.5.0 RC1, 1.5.0 Nov 25, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment