I am trying to inject a dynamic map of lists into my Quarkus application and not sure if this is possible. I have not seen any documentation from Quarkus on this matter, so I am wondering if the smallrye-config
even supports it.
app:
example:
- key: KeyExample
values:
- test 1
- test 2
- test 3
- key: KeyExample2
values:
- test 1
- test 2
- test 3
I am trying to avoid the following syntax and then performing post-processing on the configuration to achieve the desired effect:
app:
example:
- KeyExample;test 1
- KeyExample;test 2
- KeyExample;test 3
- KeyExample2;test 1
- KeyExample2;test 2
- KeyExample2;test 3
Unfortunately, SmallRye Config does not support Map<V, List<?>
directly (it can be added).
If you change the YAML slightly, it is possible to achieve the same result:
app:
example:
KeyExample:
values:
- test 1
- test 2
- test 3
KeyExample2:
values:
- test 1
- test 2
- test 3
And then you can provide a mapping for it like this:
@ConfigMapping(prefix = "app")
interface MapListConfig {
Map<String, Lists> example();
interface Lists {
List<String> values();
}
}
Feel free to open an enhancement in https://github.com/smallrye/smallrye-config/ to add the Map<V, List<?>
support.