Deprecate auto-configuration for InfluxDB

Closes gh-35190
This commit is contained in:
Andy Wilkinson
2023-07-20 12:25:01 +01:00
parent 5022e120c1
commit 3affb3342e
10 changed files with 48 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@@ -37,11 +37,16 @@ import org.springframework.context.annotation.Bean;
*
* @author Eddú Meléndez
* @since 2.0.0
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of the
* <a href="https://github.com/influxdata/influxdb-client-java">new client</a> and its own
* Spring Boot integration.
*/
@SuppressWarnings("removal")
@AutoConfiguration(after = InfluxDbAutoConfiguration.class)
@ConditionalOnClass(InfluxDB.class)
@ConditionalOnBean(InfluxDB.class)
@ConditionalOnEnabledHealthIndicator("influxdb")
@Deprecated(since = "3.2.0", forRemoval = true)
public class InfluxDbHealthContributorAutoConfiguration
extends CompositeHealthContributorConfiguration<InfluxDbHealthIndicator, InfluxDB> {

View File

@@ -32,6 +32,8 @@ import static org.mockito.Mockito.mock;
*
* @author Eddú Meléndez
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.2.0", forRemoval = true)
class InfluxDbHealthContributorAutoConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 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.
@@ -29,7 +29,11 @@ import org.springframework.util.Assert;
*
* @author Eddú Meléndez
* @since 2.0.0
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of the
* <a href="https://github.com/influxdata/influxdb-client-java">new client</a> and its own
* Spring Boot integration.
*/
@Deprecated(since = "3.2.0", forRemoval = true)
public class InfluxDbHealthIndicator extends AbstractHealthIndicator {
private final InfluxDB influxDb;

View File

@@ -36,6 +36,8 @@ import static org.mockito.Mockito.mock;
*
* @author Eddú Meléndez
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.2.0", forRemoval = true)
class InfluxDbHealthIndicatorTests {
@Test

View File

@@ -39,11 +39,16 @@ import org.springframework.context.annotation.Bean;
* @author Andy Wilkinson
* @author Phillip Webb
* @since 2.0.0
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of the
* <a href="https://github.com/influxdata/influxdb-client-java">new client</a> and its own
* Spring Boot integration.
*/
@AutoConfiguration
@ConditionalOnClass(InfluxDB.class)
@EnableConfigurationProperties(InfluxDbProperties.class)
@ConditionalOnProperty("spring.influx.url")
@Deprecated(since = "3.2.0", forRemoval = true)
@SuppressWarnings("removal")
public class InfluxDbAutoConfiguration {
@Bean

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 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.
@@ -24,8 +24,12 @@ import org.influxdb.InfluxDB;
*
* @author Eddú Meléndez
* @since 2.5.0
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of the
* <a href="https://github.com/influxdata/influxdb-client-java">new client</a> and its own
* Spring Boot integration.
*/
@FunctionalInterface
@Deprecated(since = "3.2.0", forRemoval = true)
public interface InfluxDbCustomizer {
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 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.
@@ -27,8 +27,12 @@ import org.influxdb.InfluxDB;
*
* @author Stephane Nicoll
* @since 2.1.0
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of the
* <a href="https://github.com/influxdata/influxdb-client-java">new client</a> and its own
* Spring Boot integration.
*/
@FunctionalInterface
@Deprecated(since = "3.2.0", forRemoval = true)
public interface InfluxDbOkHttpClientBuilderProvider extends Supplier<OkHttpClient.Builder> {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 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.
@@ -17,6 +17,7 @@
package org.springframework.boot.autoconfigure.influx;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
/**
* Configuration properties for InfluxDB.
@@ -24,7 +25,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Sergey Kuptsov
* @author Stephane Nicoll
* @since 2.0.0
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of the
* <a href="https://github.com/influxdata/influxdb-client-java">new InfluxDB Java
* client</a> and its own Spring Boot integration.
*/
@Deprecated(since = "3.2.0", forRemoval = true)
@ConfigurationProperties(prefix = "spring.influx")
public class InfluxDbProperties {
@@ -43,6 +48,7 @@ public class InfluxDbProperties {
*/
private String password;
@DeprecatedConfigurationProperty(reason = "the new InfluxDb Java client provides Spring Boot integration")
public String getUrl() {
return this.url;
}
@@ -51,6 +57,7 @@ public class InfluxDbProperties {
this.url = url;
}
@DeprecatedConfigurationProperty(reason = "the new InfluxDb Java client provides Spring Boot integration")
public String getUser() {
return this.user;
}
@@ -59,6 +66,7 @@ public class InfluxDbProperties {
this.user = user;
}
@DeprecatedConfigurationProperty(reason = "the new InfluxDb Java client provides Spring Boot integration")
public String getPassword() {
return this.password;
}

View File

@@ -42,6 +42,8 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Phillip Webb
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.2.0", forRemoval = true)
class InfluxDbAutoConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
@@ -102,6 +104,7 @@ class InfluxDbAutoConfigurationTests {
static class CustomOkHttpClientBuilderProviderConfig {
@Bean
@SuppressWarnings("removal")
InfluxDbOkHttpClientBuilderProvider influxDbOkHttpClientBuilderProvider() {
return () -> new OkHttpClient.Builder().readTimeout(40, TimeUnit.SECONDS);
}

View File

@@ -11,7 +11,8 @@ Spring Data provides additional projects that help you access a variety of NoSQL
* {spring-data-couchbase}[Couchbase]
* {spring-data-ldap}[LDAP]
Spring Boot provides auto-configuration for Redis, MongoDB, Neo4j, Elasticsearch, Cassandra, Couchbase, LDAP and InfluxDB.
Spring Boot provides auto-configuration for Redis, MongoDB, Neo4j, Elasticsearch, Cassandra, Couchbase, LDAP.
Auto-configuration for InfluxDB is also provided but it is deprecated in favor of https://github.com/influxdata/influxdb-client-java[the new InfluxDB Java client] that provides its own Spring Boot integration.
Additionally, {spring-boot-for-apache-geode}[Spring Boot for Apache Geode] provides {spring-boot-for-apache-geode-docs}#geode-repositories[auto-configuration for Apache Geode].
You can make use of the other projects, but you must configure them yourself.
See the appropriate reference documentation at {spring-data}.
@@ -637,22 +638,17 @@ If you have custom attributes, you can use configprop:spring.ldap.embedded.valid
[[data.nosql.influxdb]]
=== InfluxDB
WARNING: Auto-configuration for InfluxDB is deprecated and scheduled for removal in Spring Boot 3.4 in favor of https://github.com/influxdata/influxdb-client-java[the new InfluxDB Java client] that provides its own Spring Boot integration.
https://www.influxdata.com/[InfluxDB] is an open-source time series database optimized for fast, high-availability storage and retrieval of time series data in fields such as operations monitoring, application metrics, Internet-of-Things sensor data, and real-time analytics.
[[data.nosql.influxdb.connecting]]
==== Connecting to InfluxDB
Spring Boot auto-configures an `InfluxDB` instance, provided the `influxdb-java` client is on the classpath and the URL of the database is set, as shown in the following example:
Spring Boot auto-configures an `InfluxDB` instance, provided the `influxdb-java` client is on the classpath and the URL of the database is set using configprop:spring.influx.url[deprecated].
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
influx:
url: "https://172.0.0.1:8086"
----
If the connection to InfluxDB requires a user and password, you can set the `spring.influx.user` and `spring.influx.password` properties accordingly.
If the connection to InfluxDB requires a user and password, you can set the configprop:spring.influx.user[deprecated] and configprop:spring.influx.password[deprecated] properties accordingly.
InfluxDB relies on OkHttp.
If you need to tune the http client `InfluxDB` uses behind the scenes, you can register an `InfluxDbOkHttpClientBuilderProvider` bean.