Skip to content

Microprofile Provider: Stork should only call config.getValue() on properties related to Stork #1201

@Exclusivefrog28

Description

@Exclusivefrog28

Initializing Stork results in an exception if there are any configuration properties with empty strings as values.

Code to reproduce

SmallRyeConfig config = new SmallRyeConfigBuilder()
      .addDefaultSources()
      .build();

ConfigProviderResolver.instance().registerConfig(config, null);

Stork.initialize();

If there are empty system properties or environmental variables, the stork MicroProfileConfigProvider will throw an exception as it eagerly reads the configuration values for all existing properties:

Source

for (String propertyName : config.getPropertyNames()) {
    StorkConfigUtils.computeServiceProperty(propertiesByServiceName, propertyName,
            config.getValue(propertyName, String.class));
}

The resulting exception

SRCFG00040: The config property user.script is defined as the empty String ("") which the following Converter considered to be null: io.smallrye.config.Converters$BuiltInConverter

Currently I have solved this issue by adding a custom interceptor to the config provider, but I don't see why Stork needs to read the values of all properties, it really should filter them and only read the ones related to Stork (stork.*).

Versions I have used:

  • JDK 21 Eclipse Temurin 21.0.4
  • Maven 3.9.12
  • io.smallrye.config:smallrye-config-core 3.16.0
  • io.smallrye.stork:stork-core 2.7.9
  • io.smallrye.stork:stork-microprofile-config 2.7.9

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions