quarkus: Arc: Regression issue when mapping `@ConfigMapping` using a custom ConfigSource implementation
Describe the bug
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 https://github.com/quarkusio/quarkus/commit/fd4b3028afbfff649c6e92e8bb51a65a47fa6bef. 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
.
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
- git clone
https://github.com/Sgitario/quarkus-test-suite
- cd
quarkus-test-suite
- git checkout
reproducer_19448
Then, we can reproduce it using a custom config source directly:
4.a cd properties
5.a mvn clean verify -Dit.test=ConfigMappingResourceIT
Or using the spring cloud config extension:
4.b cd spring/spring-cloud-config
5.b mvn clean verify
All the tests should work, but they are failing.
Output of uname -a
or ver
No response
Output of java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
999-SNAPSHOT
Build tool (ie. output of mvnw --version
or gradlew --version
)
No response
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 15 (14 by maintainers)
Commits related to this issue
- Reverted last change due to https://github.com/quarkusio/quarkus/issues/19448 — committed to jaivalis/release-raccoon by deleted user 3 years ago
- Merge pull request #19897 from geoand/#19448 Fix use of OpenTelemetry OTLP exporter in native mode — committed to quarkusio/quarkus by kenfinnigan 3 years ago
- Enable tests for QUARKUS-1218: Regression issue for @ConfigMapping The issue https://github.com/quarkusio/quarkus/issues/19448 was fixed by https://github.com/quarkusio/quarkus/pull/19937 — committed to Sgitario/quarkus-test-suite by Sgitario 3 years ago
- Enable tests for QUARKUS-1218: Regression issue for @ConfigMapping The issue https://github.com/quarkusio/quarkus/issues/19448 was fixed by https://github.com/quarkusio/quarkus/pull/19937 — committed to Sgitario/quarkus-test-suite by Sgitario 3 years ago
I’m checking the integration test in Quarkus upstream and It’s using the
@ConfigProperty
annotation which works fine. This issue happens only when using the@ConfigMapping
annotation.I will review the commit history from last week to today by tomorrow morning to try to spot what could cause this issue.
@geoand enjoy your PTO!