Skip to content
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

Config: support all resources on classpath #1214

Closed
tomas-langer opened this issue Dec 12, 2019 · 1 comment · Fixed by #1417
Closed

Config: support all resources on classpath #1214

tomas-langer opened this issue Dec 12, 2019 · 1 comment · Fixed by #1417
Assignees
Milestone

Comments

@tomas-langer
Copy link
Member

Current implementation of config sources for classpath resources only uses the first resource found.
We should support (both from meta-config and from a builder) adding config source for each instance of a resource on a classpath.
Usage:
microprofile-config.properties already requires this approach. We can do this using a builder through ConfigSources.classpathAll("META-INF/microprofile-config.properties"), we must be able to do the same thing through meta-config

Example meta-config (an option how to implement):

sources:
  - type: "multi"
     source-type: "classpath"
     properties:
       resource: "microprofile-config.properties"

The multi would tell meta configuration that this would return multiple instances of a config source.
The source-type would point to a named ConfigSourceProvider.
This would probably require additional method in ConfigSourceProvider:
List<ConfigSource> createMulti(String type, Config metaConfig)

@tomas-langer tomas-langer added this to the 2.0.0 milestone Dec 12, 2019
@tomas-langer tomas-langer self-assigned this Jan 29, 2020
@tomas-langer
Copy link
Member Author

This is now working.
When using meta configuration, use multi-source: true to mark the source as a multiple source.
When using a builder, there are new methods on ClasspathConfigSource:

  1. createAll(Config) to load all sources from meta configuration
  2. createAll(String) to load all resource instances from the classpath

Resolved by #1417

@tomas-langer tomas-langer linked a pull request Mar 10, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant