3

I'm trying to use quarkus yaml extension as my main source for configs and I was trying to figure out what the best approach is for loading a map from the yaml file.

The application.yml:

quarkus:
  http:
    port: 8080
configuration:
  value:
    name1: test1
    name2: test2
    name3: test3

In the code I tried to inject the config value like this:

@ConfigProperty(name = "configuration.value")
Values value;

Where Values contains a custom Eclipse Microprofile Converter. The converter looks like this:

public class ValueConverter implements Converter<Values> {
    @Override
    public Values convert(String value) {
        // Here there would be the actual code to convert to Map.
        return new Values(map);
    }
}

The problem is that String value comes empty, ie, it does not loading the stull below configuration.value:

name1: test1
name2: test2
name3: test3

I've also tried annotating a class with @ConfigProperties(prefix = "configuration.value") and have a map inside but then it does not know how to map that to a Map as expected... Is there a way to create custom config properties converter?

Is this a Eclipse Microprofile issue? Is this a bug? Is this a feature request? :) Or, is there another/better way of doing this?

Thanks for the help!

ktulinho
  • 3,870
  • 9
  • 28
  • 35

1 Answers1

1

As has been answered on the mailing list here, this is not something supported by Eclipse MicroProfile Config - and therefore Quarkus

geoand
  • 60,071
  • 24
  • 172
  • 190