I want to be able to specify a list of key/value pairs in my application.yml file and inject using @ConfigProperty but I get a runtime error.
app:
response-headers:
header1 : value1
header2 : value2
header3 : value3
header4 : value4
public AppLifecycle(@ConfigProperty(name = "app.response-headers") Map<String, String> responseHeaders) {
this.responseHeaders = responseHeaders;
}
But I get this error:
Caused by: java.lang.IllegalArgumentException: SRCFG00013: No Converter registered for interface java.util.Map
at io.smallrye.config.SmallRyeConfig.lambda$getConverter$2(SmallRyeConfig.java:289)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
at io.smallrye.config.SmallRyeConfig.getConverter(SmallRyeConfig.java:286)
at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:141)
at io.quarkus.arc.runtime.ConfigBeanCreator.create(ConfigBeanCreator.java:48)
I tried HashMap too.
Do I have to configure SmallRyeConfig to read a Map somehow?
-Dave