Skip to content

Update SmallRye Config to 3.13.0 #47984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 6 additions & 52 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<microprofile-lra.version>2.0.1</microprofile-lra.version>
<microprofile-openapi.version>4.0.2</microprofile-openapi.version>
<smallrye-common.version>2.12.0</smallrye-common.version>
<smallrye-config.version>3.12.4</smallrye-config.version>
<smallrye-config.version>3.13.0</smallrye-config.version>
<smallrye-health.version>4.2.0</smallrye-health.version>
<smallrye-metrics.version>4.0.0</smallrye-metrics.version>
<smallrye-open-api.version>4.0.10</smallrye-open-api.version>
Expand Down Expand Up @@ -4119,69 +4119,23 @@
<version>${project.version}</version>
</dependency>
<dependency>
<!-- NOTE: this dependency is here to cause relocations to work; DO NOT MODIFY -->
<groupId>io.smallrye</groupId>
<artifactId>smallrye-config</artifactId>
<!-- This is intentionally hard-coded -->
<version>1.5.0</version>
</dependency>
<dependency>
<!-- NOTE: this dependency is here to cause relocations to work; DO NOT MODIFY -->
<groupId>io.smallrye</groupId>
<artifactId>smallrye-config-common</artifactId>
<!-- This is intentionally hard-coded -->
<version>1.5.0</version>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-bom</artifactId>
<version>${smallrye-config.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config</artifactId>
<version>${smallrye-config.version}</version>
<exclusions>
<exclusion>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.annotation.versioning</artifactId>
</exclusion>
<exclusion>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-common</artifactId>
<version>${smallrye-config.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-core</artifactId>
<version>${smallrye-config.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-validator</artifactId>
<version>${smallrye-config.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-source-file-system</artifactId>
<version>${smallrye-config.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-source-yaml</artifactId>
<version>${smallrye-config.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-source-keystore</artifactId>
<version>${smallrye-config.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-crypto</artifactId>
<version>${smallrye-config.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-health</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package io.quarkus.restclient.configuration;

import java.util.Collections;
import java.util.Map;
import java.util.Set;

import org.eclipse.microprofile.config.spi.ConfigSource;

import io.smallrye.config.SmallRyeConfigBuilder;
import io.smallrye.config.SmallRyeConfigBuilderCustomizer;
import io.smallrye.config.common.MapBackedConfigSource;

public class RestClientBuildTimeConfigBuilderCustomizer implements SmallRyeConfigBuilderCustomizer {
private static final Map<String, String> BUILD_TIME_PROPERTIES = Map.of(
"io.quarkus.restclient.configuration.EchoClient/mp-rest/url", "http://nohost",
"BT-MP/mp-rest/url", "from-mp",
"BT-QUARKUS-MP/mp-rest/url", "from-mp",
"quarkus.rest-client.BT-QUARKUS-MP.url", "from-quarkus");

@Override
public void configBuilder(final SmallRyeConfigBuilder builder) {
boolean isBuildTime = false;
for (ConfigSource source : builder.getSources()) {
if ("PropertiesConfigSource[source=Build system]".equals(source.getName())) {
isBuildTime = true;
break;
}
}

if (isBuildTime) {
// A build time only source to test the recording of configuration values.
builder.withSources(
new MapBackedConfigSource("RestClientBuildTimeConfigSource", BUILD_TIME_PROPERTIES, Integer.MAX_VALUE) {
});
} else {
builder.withSources(new MapBackedConfigSource("RestClientRuntimeConfigSource", Map.of(), Integer.MAX_VALUE) {
@Override
public String getValue(final String propertyName) {
if (!propertyName.equals("io.quarkus.restclient.configuration.EchoClient/mp-rest/url")) {
return null;
}

return "http://localhost:${quarkus.http.test-port:8081}";
}

@Override
public Set<String> getPropertyNames() {
return Collections.singleton("io.quarkus.restclient.configuration.EchoClient/mp-rest/url");
}
});
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ public class RestClientOverrideRuntimeConfigTest {
@RegisterExtension
static final QuarkusUnitTest TEST = new QuarkusUnitTest().setArchiveProducer(
() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(EchoResource.class, EchoClient.class, RestClientBuildTimeConfigSource.class,
RestClientRunTimeConfigSource.class)
.addAsServiceProvider("org.eclipse.microprofile.config.spi.ConfigSource",
"io.quarkus.restclient.configuration.RestClientBuildTimeConfigSource",
"io.quarkus.restclient.configuration.RestClientRunTimeConfigSource"));
.addClasses(EchoResource.class, EchoClient.class, RestClientBuildTimeConfigBuilderCustomizer.class)
.addAsServiceProvider("io.smallrye.config.SmallRyeConfigBuilderCustomizer",
"io.quarkus.restclient.configuration.RestClientBuildTimeConfigBuilderCustomizer"));

@Inject
@RestClient
Expand Down Expand Up @@ -59,7 +57,7 @@ void overrideConfig() {
ConfigValue quarkusValue = config
.getConfigValue("quarkus.rest-client.\"io.quarkus.restclient.configuration.EchoClient\".url");
assertEquals(mpValue.getValue(), quarkusValue.getValue());
assertEquals(RestClientRunTimeConfigSource.class.getName(), quarkusValue.getConfigSourceName());
assertEquals("RestClientRuntimeConfigSource", quarkusValue.getConfigSourceName());
// There is no relocate for MP names, so it keeps the same name
assertEquals(mpValue.getName(), "io.quarkus.restclient.configuration.EchoClient/mp-rest/url");
// We use the Quarkus name, because that is the one that has priority
Expand Down

This file was deleted.

Loading