Description
openedon Apr 16, 2023
Describe the bug
Extension writing guide recommends using @ConfigMapping
instead of @ConfigRoot
with prefix and name but in case of split config with same prefix for build time and run time SR Config validation effectively forbids it.
Similar approach with @ConfigRoot(prefix = "my", name = "", phase = ...)
seems to work fine.
See also: zulip thread.
Expected behavior
Ability to map configuration properties to both run time and build time config with validation failure only if the property is absent in both.
Actual behavior
ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: io.smallrye.config.ConfigValidationException: Configuration validation failed:
my.greeting does not map to any root
How to Reproduce?
Reproducer:
quarkus create extension org.acme:my-ext && cd my-ext
- Add following classes to
runtime
module
@ConfigMapping(prefix = "my")
@ConfigRoot(phase = ConfigPhase.RUN_TIME)
public interface MyExtRunTimeConfig {
/** */
String greeting();
}
@ConfigMapping(prefix = "my")
@ConfigRoot(phase = ConfigPhase.BUILD_TIME)
public interface MyExtBuildTimeConfig {
/** */
@WithDefault("true")
boolean enabled();
}
- Add
<module>intergration-tests</module>
to rootpom.xml
- Add
my.greeting = Hi
tointegration-tests/src/main/resources/application.properties
- Run
quarkus dev
Output of uname -a
or ver
Linux unterwelt 6.2.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 07 Apr 2023 02:10:43 +0000 x86_64 GNU/Linux
Output of java -version
openjdk 17.0.6 2023-01-17 OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10) OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.16.6.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29)
Additional information
No response