I have the following configuration:
my:
filter:
number-range:
- range:
from: +994700110000
to: +994700110002
The ConfigMapping is:
@ConfigMapping(prefix = "my.filter")
public interface SmsGatewayFilterListConfig {
List<RangeWrapper> numberRange();
}
with pojos:
public record RangeWrapper(Range range) {
}
public record Range(String from,
String to) {
}
And my converter (registered in META-INF/services/org.eclipse.microprofile.config.spi.Converter
):
import org.eclipse.microprofile.config.spi.Converter;
import org.yaml.snakeyaml.Yaml;
public class RangeWrapperConverter implements Converter<RangeWrapper> {
@Override
public RangeWrapper convert(String s) throws IllegalArgumentException, NullPointerException {
System.out.println("Got: " + s);
return new Yaml().loadAs(s, RangeWrapper.class);
}
}
I have the quarkus-config-yaml
dependency set, and am using application.yml
When i try to startup my quarkus app, I am getting parsing issues however, as the string which is passed to my converter is being:
{"number-range": [{"range": {"from": "+994700110000"
This seems to somehow be in json format, and even then not providing the full content of my yaml. What can be wrong please?