From 6b70e67b982aa0b1e4746d8ffed12a7e51645bfd Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Thu, 19 Aug 2021 10:52:52 +0200 Subject: [PATCH] Properly deprecate quarkus.resteasy.metrics.enabled Fix #19480 --- .../common/deployment/ResteasyServerCommonProcessor.java | 9 +++++---- .../metrics/deployment/JaxRsMetricsProcessor.java | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java b/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java index ed472ecaf1eea..e6e19e00900e2 100755 --- a/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java +++ b/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java @@ -147,11 +147,12 @@ static final class ResteasyConfig { * See MicroProfile * Metrics: Optional REST metrics. - *

- * Deprecated. Use {@code quarkus.smallrye-metrics.jaxrs.enabled}. + * + * @deprecated Use {@code quarkus.smallrye-metrics.jaxrs.enabled} instead. */ - @ConfigItem(name = "metrics.enabled", defaultValue = "false") - public boolean metricsEnabled; + @Deprecated(forRemoval = true) + @ConfigItem(name = "metrics.enabled") + public Optional metricsEnabled; /** * Ignore all explicit JAX-RS {@link Application} classes. diff --git a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/JaxRsMetricsProcessor.java b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/JaxRsMetricsProcessor.java index d86b4d39fc021..f9252e5b0b3fd 100644 --- a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/JaxRsMetricsProcessor.java +++ b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/JaxRsMetricsProcessor.java @@ -32,7 +32,7 @@ static class RestMetricsEnabled implements BooleanSupplier { SmallRyeMetricsProcessor.SmallRyeMetricsConfig smConfig; public boolean getAsBoolean() { - boolean resteasyConfigEnabled = ConfigProvider.getConfig().getOptionalValue(RESTEASY_CONFIG_PROPERTY, boolean.class) + boolean resteasyConfigEnabled = ConfigProvider.getConfig().getOptionalValue(RESTEASY_CONFIG_PROPERTY, Boolean.class) .orElse(false); return smConfig.extensionsEnabled && (smConfig.jaxrsEnabled || resteasyConfigEnabled); } @@ -73,7 +73,7 @@ void enableMetrics(Optional metricsCapabilityBuildIt } private void warnIfDeprecatedResteasyPropertiesPresent() { - if (ConfigProvider.getConfig().getOptionalValue(RESTEASY_CONFIG_PROPERTY, boolean.class).isPresent()) { + if (ConfigProvider.getConfig().getOptionalValue(RESTEASY_CONFIG_PROPERTY, Boolean.class).isPresent()) { SmallRyeMetricsProcessor.LOGGER.warn( "`quarkus.resteasy.metrics.enabled` is deprecated and will be removed in a future version. " + "Use `quarkus.smallrye-metrics.jaxrs.enabled` to enable metrics for REST endpoints "