From b9abd2977f365a1fb2959e24bad6c18d3de1c231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduard=20Tudenh=C3=B6fner?= Date: Wed, 25 Aug 2021 09:55:47 +0200 Subject: [PATCH] Replace usage of deprecated ConfigProperties with ConfigMapping (#1814) --- pom.xml | 2 +- .../server/config/DynamoVersionStoreConfig.java | 16 ++++++++++------ .../server/config/JGitVersionStoreConfig.java | 12 +++++++----- .../server/config/QuarkusServerConfig.java | 13 ++++++++----- .../server/config/VersionStoreConfig.java | 16 ++++++++++------ 5 files changed, 36 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index c1fc5cb9dcb..1af0ac35a48 100644 --- a/pom.xml +++ b/pom.xml @@ -155,7 +155,7 @@ 2.0 0.9.0 3.17.3 - 2.1.3.Final + 2.2.0.CR1 2020.0.10 2.12.13 2.13.6 diff --git a/servers/quarkus-server/src/main/java/org/projectnessie/server/config/DynamoVersionStoreConfig.java b/servers/quarkus-server/src/main/java/org/projectnessie/server/config/DynamoVersionStoreConfig.java index 6221c1f94a7..6e5e083ec66 100644 --- a/servers/quarkus-server/src/main/java/org/projectnessie/server/config/DynamoVersionStoreConfig.java +++ b/servers/quarkus-server/src/main/java/org/projectnessie/server/config/DynamoVersionStoreConfig.java @@ -15,20 +15,24 @@ */ package org.projectnessie.server.config; -import io.quarkus.arc.config.ConfigProperties; -import org.eclipse.microprofile.config.inject.ConfigProperty; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; import org.projectnessie.versioned.dynamodb.DynamoStoreConfig; /** DynamoDB version store configuration. */ -@ConfigProperties(prefix = "nessie.version.store.dynamo") +@ConfigMapping(prefix = "nessie.version.store.dynamo") public interface DynamoVersionStoreConfig { - @ConfigProperty(name = "initialize", defaultValue = "false") + @WithName("initialize") + @WithDefault("false") boolean isDynamoInitialize(); - @ConfigProperty(defaultValue = DynamoStoreConfig.TABLE_PREFIX) + @WithName("table-prefix") + @WithDefault(DynamoStoreConfig.TABLE_PREFIX) String getTablePrefix(); - @ConfigProperty(name = "tracing", defaultValue = "true") + @WithName("tracing") + @WithDefault("true") boolean enableTracing(); } diff --git a/servers/quarkus-server/src/main/java/org/projectnessie/server/config/JGitVersionStoreConfig.java b/servers/quarkus-server/src/main/java/org/projectnessie/server/config/JGitVersionStoreConfig.java index d1b7eb058c5..8deaace27b2 100644 --- a/servers/quarkus-server/src/main/java/org/projectnessie/server/config/JGitVersionStoreConfig.java +++ b/servers/quarkus-server/src/main/java/org/projectnessie/server/config/JGitVersionStoreConfig.java @@ -15,13 +15,14 @@ */ package org.projectnessie.server.config; -import io.quarkus.arc.config.ConfigProperties; import io.quarkus.runtime.annotations.RegisterForReflection; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; import java.util.Optional; -import org.eclipse.microprofile.config.inject.ConfigProperty; /** JGit version store configuration. */ -@ConfigProperties(prefix = "nessie.version.store.jgit") +@ConfigMapping(prefix = "nessie.version.store.jgit") public interface JGitVersionStoreConfig { @RegisterForReflection public enum JGitStoreType { @@ -29,9 +30,10 @@ public enum JGitStoreType { INMEMORY } - @ConfigProperty(name = "type", defaultValue = "INMEMORY") + @WithName("type") + @WithDefault("INMEMORY") JGitStoreType getJgitStoreType(); - @ConfigProperty(name = "directory") + @WithName("directory") Optional getJgitDirectory(); } diff --git a/servers/quarkus-server/src/main/java/org/projectnessie/server/config/QuarkusServerConfig.java b/servers/quarkus-server/src/main/java/org/projectnessie/server/config/QuarkusServerConfig.java index 1cb68681a18..7311df7bf31 100644 --- a/servers/quarkus-server/src/main/java/org/projectnessie/server/config/QuarkusServerConfig.java +++ b/servers/quarkus-server/src/main/java/org/projectnessie/server/config/QuarkusServerConfig.java @@ -15,19 +15,22 @@ */ package org.projectnessie.server.config; -import io.quarkus.arc.config.ConfigProperties; -import org.eclipse.microprofile.config.inject.ConfigProperty; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; import org.projectnessie.services.config.ServerConfig; /** Nessie server config for Quarkus. */ -@ConfigProperties(prefix = "nessie.server") +@ConfigMapping(prefix = "nessie.server") public interface QuarkusServerConfig extends ServerConfig { - @ConfigProperty(name = "default-branch", defaultValue = "main") @Override + @WithName("default-branch") + @WithDefault("main") String getDefaultBranch(); - @ConfigProperty(name = "send-stacktrace-to-client", defaultValue = "false") @Override + @WithName("send-stacktrace-to-client") + @WithDefault("false") boolean sendStacktraceToClient(); } diff --git a/servers/quarkus-server/src/main/java/org/projectnessie/server/config/VersionStoreConfig.java b/servers/quarkus-server/src/main/java/org/projectnessie/server/config/VersionStoreConfig.java index 0938c487008..f76326b1009 100644 --- a/servers/quarkus-server/src/main/java/org/projectnessie/server/config/VersionStoreConfig.java +++ b/servers/quarkus-server/src/main/java/org/projectnessie/server/config/VersionStoreConfig.java @@ -15,12 +15,13 @@ */ package org.projectnessie.server.config; -import io.quarkus.arc.config.ConfigProperties; import io.quarkus.runtime.annotations.RegisterForReflection; -import org.eclipse.microprofile.config.inject.ConfigProperty; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; /** Version store configuration. */ -@ConfigProperties(prefix = "nessie.version.store") +@ConfigMapping(prefix = "nessie.version.store") public interface VersionStoreConfig { @RegisterForReflection @@ -30,17 +31,20 @@ public enum VersionStoreType { JGIT } - @ConfigProperty(name = "type", defaultValue = "INMEMORY") + @WithName("type") + @WithDefault("INMEMORY") VersionStoreType getVersionStoreType(); /** * Whether calls against the version-store are traced with OpenTracing/OpenTelemetry (Jaeger), * enabled by default. */ - @ConfigProperty(name = "trace.enable", defaultValue = "true") + @WithName("trace.enable") + @WithDefault("true") boolean isTracingEnabled(); /** Whether metrics for the version-store are enabled (enabled by default). */ - @ConfigProperty(name = "metrics.enable", defaultValue = "true") + @WithName("metrics.enable") + @WithDefault("true") boolean isMetricsEnabled(); }