Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-1218

Arc: Regression issue when mapping @ConfigMapping using a custom ConfigSource implementation

XMLWordPrintable

    • Workaround Exists
    • Hide

      Add all the properties from the external servers to application.properties

      Show
      Add all the properties from the external servers to application.properties
    • +

      Github Issue: https://github.com/quarkusio/quarkus/issues/19448

      This issue affects all users that provide a custom config source (org.eclipse.microprofile.config.spi.ConfigSource). For example:

      public class CustomConfigSource implements ConfigSource {
      
          private static final int ORDINAL = 999;
          private static final String PROPERTIES_FILE = "/configsource.properties";
      
          // ...
      }
      
      

      Where configsource.properties is:

      from.custom.source.person.name=From Config Source
      from.custom.source.person.age=33
      

      When mapping:

      @Path("/config-mapping")
      public class ConfigMappingResource {
      
          @Inject
          @ConfigMapping(prefix = "from.custom.source.person")
          PersonInterface personFromCustomSourceInterface;
      

      It does not work any longer by failing with the following exception:

      [app] Caused by: io.smallrye.config.ConfigValidationException: Configuration validation failed:
      08:56:23.182 INFO  [app]        java.util.NoSuchElementException: SRCFG00014: The config property from.custom.source.person.name is required but it could not be found in any config source
      08:56:23.183 INFO  [app]        java.util.NoSuchElementException: SRCFG00014: The config property from.custom.source.person.age is required but it could not be found in any config source
      08:56:23.184 INFO  [app]        at io.smallrye.config.ConfigMappingProvider.mapConfiguration(ConfigMappingProvider.java:840)
      08:56:23.185 INFO  [app]        at io.smallrye.config.ConfigMappingProvider.mapConfiguration(ConfigMappingProvider.java:796)
      08:56:23.186 INFO  [app]        at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:403)
      08:56:23.186 INFO  [app]        ... 17 more
      The root cause of this issue is this commit fd4b302. Note that this is a regression test that was working fine in 2.1.2.Final.
      

      The issue also affects the extension quarkus-spring-cloud-config-client to inject properties using @ConfigMapping and also the consul extension.

            rcortez@redhat.com Roberto Cortez
            jcarvaja@redhat.com Jose Carvajal Hilario
            Josef Smrcka Josef Smrcka (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: