Smallrye config with list #24107
-
I just got a problem when configuring my application and I really do not know how to get around it. I think it is by design, but I feel this design quite annoying. I am using common lang Range class.
Recently we had the requirement of supporting multiple ranges, so I told myself "oh easy", just have to change the type to a list and it should work almost as is.. wrong
I was under the impression the string from the config would still be splitted at the comma, then the list would be built but instead I get; Then I went with creating a subinterface route as the config guide shows; something like this;
I could get this to work only by using indexed properties like this;
this would not work; The problem I have is that we use env variables, to configure the app within k8s, and indexed properties aren't supported this way. So I am blocked at the moment with that seemingly really simple problem. Any help or workarounds would be greatly appreciated. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
In the end I ended up creating my own |
Beta Was this translation helpful? Give feedback.
-
This should work: @WithConverter(RangeConverter.class)
List<Range> list(); But it seems that in the case of the list, the In the meanwhile, I'll have a look into SmallRye Config to make this work without having to register the Converter with the ServiceLoader in the case of a List. |
Beta Was this translation helpful? Give feedback.
This should work:
But it seems that in the case of the list, the
RangeConverter
is not being added to the converter list, so you get the error messageNo Converter registered...
. Please, register the Converter manually like this: https://quarkus.io/guides/config-extending-support#custom-converter.In the meanwhile, I'll have a look into SmallRye Config to make this work without having to register the Converter with the ServiceLoader in the case of a List.