From 568b8ccb7367ac95b10ac6e2290b894af516c2c1 Mon Sep 17 00:00:00 2001 From: Roberto Cortez Date: Fri, 31 Mar 2023 20:36:11 +0100 Subject: [PATCH] Update SmallRye Config to 3.2.1 --- bom/application/pom.xml | 2 +- .../quarkus/arc/test/config/ConfigMappingTest.java | 5 ++--- .../config/RedisBuildTimeConfigSource.java | 14 ++++++++++++++ ...rg.eclipse.microprofile.config.spi.ConfigSource | 1 + .../redis/deployment/RedisCacheProcessor.java | 6 ------ 5 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/config/RedisBuildTimeConfigSource.java create mode 100644 extensions/cache/deployment/src/main/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 4dd6962917bb59..0087543493950a 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -58,7 +58,7 @@ 2.0 3.1 2.1.0 - 3.2.0 + 3.2.1 4.0.1 4.0.0 3.3.2 diff --git a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigMappingTest.java b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigMappingTest.java index be92a6f2d2c220..16f7cf9a7e8a32 100644 --- a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigMappingTest.java +++ b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigMappingTest.java @@ -3,7 +3,6 @@ import static java.util.stream.Collectors.toList; import static java.util.stream.StreamSupport.stream; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -304,8 +303,8 @@ void defaults() { assertEquals("bar", defaults.bar()); assertEquals("foo", config.getValue("defaults.foo", String.class)); - final List propertyNames = stream(config.getPropertyNames().spliterator(), false).collect(toList()); - assertFalse(propertyNames.contains("defaults.foo")); + List propertyNames = stream(config.getPropertyNames().spliterator(), false).collect(toList()); + assertTrue(propertyNames.contains("defaults.foo")); } @ConfigMapping(prefix = "converters") diff --git a/extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/config/RedisBuildTimeConfigSource.java b/extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/config/RedisBuildTimeConfigSource.java new file mode 100644 index 00000000000000..877b5ceff9adcc --- /dev/null +++ b/extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/config/RedisBuildTimeConfigSource.java @@ -0,0 +1,14 @@ +package io.quarkus.cache.deployment.config; + +import io.smallrye.config.common.MapBackedConfigSource; + +import java.util.Map; + +/** + * To override "quarkus.cache.type" in {@link io.quarkus.cache.runtime.CacheBuildConfig#type()} + */ +public class RedisBuildTimeConfigSource extends MapBackedConfigSource { + public RedisBuildTimeConfigSource() { + super("RedisBuildTimeConfigSource", Map.of("quarkus.cache.type", "redis"), Integer.MAX_VALUE); + } +} diff --git a/extensions/cache/deployment/src/main/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource b/extensions/cache/deployment/src/main/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource new file mode 100644 index 00000000000000..a40d782665fed2 --- /dev/null +++ b/extensions/cache/deployment/src/main/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource @@ -0,0 +1 @@ +io.quarkus.cache.deployment.config.RedisBuildTimeConfigSource diff --git a/extensions/redis-cache/deployment/src/main/java/io/quarkus/cache/redis/deployment/RedisCacheProcessor.java b/extensions/redis-cache/deployment/src/main/java/io/quarkus/cache/redis/deployment/RedisCacheProcessor.java index ebbce3ad96db56..ca908f3006e978 100644 --- a/extensions/redis-cache/deployment/src/main/java/io/quarkus/cache/redis/deployment/RedisCacheProcessor.java +++ b/extensions/redis-cache/deployment/src/main/java/io/quarkus/cache/redis/deployment/RedisCacheProcessor.java @@ -34,7 +34,6 @@ import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.Record; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; -import io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.redis.client.deployment.RequestedRedisClientBuildItem; import io.quarkus.redis.runtime.client.config.RedisConfig; @@ -62,11 +61,6 @@ RequestedRedisClientBuildItem requestedRedisClientBuildItem(RedisCachesBuildTime return new RequestedRedisClientBuildItem(buildConfig.clientName.orElse(RedisConfig.DEFAULT_CLIENT_NAME)); } - @BuildStep - RunTimeConfigurationDefaultBuildItem redisCacheByDefault() { - return new RunTimeConfigurationDefaultBuildItem("quarkus.cache.type", "redis"); - } - @BuildStep void nativeImage(BuildProducer producer) { producer.produce(ReflectiveClassBuildItem.builder(CompositeCacheKey.class).methods(true).build());