i'm trying to inject a list of object in quarkus but I receive an error "No Converter registered for class ExternalApiParam".
My yaml is:
custom:
external-api-list:
- name: example-1
uri: https://run.mocky.io/v3/55402172-82c3
- name: example-2
uri: https://run.mocky.io/v3/13417375-a19c
My config class is:
@ConfigProperties(prefix = "custom")
@Data
public class ExternalApiConfigProperties {
List<ExternalApiParam> externalApiList;
}
What do I wrong?
You need to provide a Config Converter class that can read the configuration value and convert it to your object.
Please check here for an example: https://github.com/smallrye/smallrye-config/blob/master/sources/yaml/src/test/java/io/smallrye/config/source/yaml/YamlConfigSourceTest.java#L141-L153
And how to use Converters: https://quarkus.io/guides/config#custom-configuration-converters