Move code from spring-boot-actuator to spring-boot-r2dbc
This commit is contained in:
committed by
Phillip Webb
parent
f0a8c8fa28
commit
7d4c95815d
@@ -27,11 +27,11 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.SimpleAutowireCandidateResolver;
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration;
|
||||
import org.springframework.boot.actuate.metrics.r2dbc.ConnectionPoolMetrics;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.r2dbc.actuate.metrics.ConnectionPoolMetrics;
|
||||
import org.springframework.boot.r2dbc.autoconfigure.R2dbcAutoConfiguration;
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,12 +22,12 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeReactiveHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.ReactiveHealthContributor;
|
||||
import org.springframework.boot.actuate.r2dbc.ConnectionFactoryHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.r2dbc.actuate.health.ConnectionFactoryHealthIndicator;
|
||||
import org.springframework.boot.r2dbc.autoconfigure.R2dbcAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.springframework.context.annotation.Bean;
|
||||
* @since 2.3.0
|
||||
*/
|
||||
@AutoConfiguration(after = R2dbcAutoConfiguration.class)
|
||||
@ConditionalOnClass(ConnectionFactory.class)
|
||||
@ConditionalOnClass({ ConnectionFactory.class, ConnectionFactoryHealthIndicator.class })
|
||||
@ConditionalOnBean(ConnectionFactory.class)
|
||||
@ConditionalOnEnabledHealthIndicator("r2dbc")
|
||||
public class ConnectionFactoryHealthContributorAutoConfiguration
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.boot.actuate.autoconfigure.r2dbc;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
|
||||
import org.springframework.boot.actuate.r2dbc.ConnectionFactoryHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.r2dbc.actuate.health.ConnectionFactoryHealthIndicator;
|
||||
import org.springframework.boot.r2dbc.autoconfigure.R2dbcAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
|
||||
|
||||
@@ -33,8 +33,6 @@ dependencies {
|
||||
optional("io.micrometer:micrometer-registry-prometheus-simpleclient")
|
||||
optional("io.prometheus:prometheus-metrics-exposition-formats")
|
||||
optional("io.prometheus:prometheus-metrics-exporter-pushgateway")
|
||||
optional("io.r2dbc:r2dbc-pool")
|
||||
optional("io.r2dbc:r2dbc-spi")
|
||||
optional("io.undertow:undertow-servlet")
|
||||
optional("javax.cache:cache-api")
|
||||
optional("org.apache.tomcat.embed:tomcat-embed-core")
|
||||
@@ -81,7 +79,6 @@ dependencies {
|
||||
testImplementation("com.squareup.okhttp3:mockwebserver")
|
||||
testImplementation("io.micrometer:micrometer-observation-test")
|
||||
testImplementation("io.projectreactor:reactor-test")
|
||||
testImplementation("io.r2dbc:r2dbc-h2")
|
||||
testImplementation("net.minidev:json-smart")
|
||||
testImplementation("org.apache.logging.log4j:log4j-to-slf4j")
|
||||
testImplementation("org.glassfish.jersey.media:jersey-media-json-jackson")
|
||||
|
||||
@@ -14,13 +14,20 @@ dependencies {
|
||||
api(project(":spring-boot-project:spring-boot-sql"))
|
||||
api(project(":spring-boot-project:spring-boot-tx"))
|
||||
api("org.springframework:spring-r2dbc")
|
||||
api("org.springframework:spring-r2dbc")
|
||||
|
||||
compileOnly("com.fasterxml.jackson.core:jackson-annotations")
|
||||
|
||||
optional(project(":spring-boot-project:spring-boot-actuator"))
|
||||
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
optional(project(":spring-boot-project:spring-boot-jdbc"))
|
||||
optional("io.micrometer:micrometer-core")
|
||||
optional("io.r2dbc:r2dbc-pool")
|
||||
optional("io.r2dbc:r2dbc-proxy")
|
||||
optional("io.r2dbc:r2dbc-spi")
|
||||
|
||||
testCompileOnly("com.fasterxml.jackson.core:jackson-annotations")
|
||||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-jdbc"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.r2dbc;
|
||||
package org.springframework.boot.r2dbc.actuate.health;
|
||||
|
||||
import io.r2dbc.spi.Connection;
|
||||
import io.r2dbc.spi.ConnectionFactory;
|
||||
@@ -37,7 +37,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Stephane Nicoll
|
||||
* @since 2.3.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class ConnectionFactoryHealthIndicator extends AbstractReactiveHealthIndicator {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,6 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Actuator support for R2DBC metrics.
|
||||
* Health integration for R2DBC.
|
||||
*/
|
||||
package org.springframework.boot.actuate.metrics.r2dbc;
|
||||
package org.springframework.boot.r2dbc.actuate.health;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.metrics.r2dbc;
|
||||
package org.springframework.boot.r2dbc.actuate.metrics;
|
||||
|
||||
import io.micrometer.core.instrument.Gauge;
|
||||
import io.micrometer.core.instrument.Gauge.Builder;
|
||||
@@ -30,7 +30,7 @@ import io.r2dbc.pool.PoolMetrics;
|
||||
*
|
||||
* @author Tadaya Tsuyukubo
|
||||
* @author Stephane Nicoll
|
||||
* @since 2.3.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class ConnectionPoolMetrics implements MeterBinder {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,6 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Actuator support for R2DBC.
|
||||
* Metrics for R2DBC.
|
||||
*/
|
||||
package org.springframework.boot.actuate.r2dbc;
|
||||
package org.springframework.boot.r2dbc.actuate.metrics;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.r2dbc;
|
||||
package org.springframework.boot.r2dbc.actuate.health;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collections;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.metrics.r2dbc;
|
||||
package org.springframework.boot.r2dbc.actuate.metrics;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collections;
|
||||
Reference in New Issue
Block a user