From f11b5d08471e0d3dfd1fa6a7a8df9833ab02398d Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Mon, 22 Jan 2024 11:01:02 +0100 Subject: [PATCH 01/10] feat: upgrade Spring to v6, SpringBoot to v3 --- .../internal/QueryReactiveApiImpl.java | 5 ++--- spring/README.md | 20 +++++++++---------- spring/pom.xml | 8 ++++---- ...uxDB2HealthIndicatorAutoConfiguration.java | 6 +++++- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/client-reactive/src/main/java/com/influxdb/client/reactive/internal/QueryReactiveApiImpl.java b/client-reactive/src/main/java/com/influxdb/client/reactive/internal/QueryReactiveApiImpl.java index 773f058de92..4448e082abe 100644 --- a/client-reactive/src/main/java/com/influxdb/client/reactive/internal/QueryReactiveApiImpl.java +++ b/client-reactive/src/main/java/com/influxdb/client/reactive/internal/QueryReactiveApiImpl.java @@ -44,7 +44,6 @@ import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.core.Observable; import io.reactivex.rxjava3.core.ObservableEmitter; -import org.jetbrains.annotations.NotNull; import org.reactivestreams.Publisher; /** @@ -355,7 +354,7 @@ public Publisher queryRaw(@Nonnull final Publisher queryStream, .map(q -> new Query().query(q).dialect(dialect)), dialect, org); } - @NotNull + @Nonnull private Consumer onError(final ObservableEmitter subscriber) { return throwable -> { if (!subscriber.isDisposed()) { @@ -366,4 +365,4 @@ private Consumer onError(final ObservableEmitter subscriber) { } }; } -} \ No newline at end of file +} diff --git a/spring/README.md b/spring/README.md index ea45d0e5a71..a21a8dcc4e5 100644 --- a/spring/README.md +++ b/spring/README.md @@ -10,10 +10,9 @@ ## Spring Boot Compatibility -:warning: The client version `6.4.0` upgrades the `OkHttp` library to version `4.10.0`. The version `3.12.x` is no longer supported - [okhttp#requirements](https://github.com/square/okhttp#requirements). +:warning: The client version `7.0.0` upgrades the `OkHttp` library to version `4.12.0`. The version `3.x.x` is no longer supported - [okhttp#requirements](https://github.com/square/okhttp#requirements). -The `spring-boot` supports the `OkHttp:4.10.0` from the version `3.0.0-M4` - [spring-boot/OkHttp 4.10,0](https://github.com/spring-projects/spring-boot/commit/6cb1a958a5d43a2fffb7e7635e3be9c0ee15f3b1). -For the older version of `spring-boot` you have to configure Spring Boot's `okhttp3.version` property: +The `spring-boot` supports the `OkHttp:4.12.0`. For the older version of `spring-boot` you have to configure Spring Boot's `okhttp3.version` property: ```xml @@ -43,7 +42,7 @@ influx: connectTimeout: 5s # Connection timeout for OkHttpClient. (Default: 10s) ``` -:warning: If you are using a version of Spring Boot prior to 2.7, auto-configuration will not take effect. +:warning: If you are using a version of **Spring Boot prior to 2.7 with 6.x version of the client**, auto-configuration will not take effect. You need to add the `@ComponentScan` annotation to your Spring Boot startup class and include com.influxdb.spring.influx in the basePackages. For example: ```java @@ -62,7 +61,7 @@ If you want to configure the `InfluxDBClientReactive` client, you need to includ ## Actuator for InfluxDB2 micrometer registry -To enable export metrics to **InfluxDB 2.x** you need to include `micrometer-core` on your classpath. +To enable export metrics to **InfluxDB 2.x** you need to include `micrometer-registry-influx` on your classpath. (Due to package conflicts, the `spring-boot-actuator` may have relied on an earlier version of the `micrometer-core`. Therefore, it is necessary to specify a higher version here.) The default configuration can be override via properties: @@ -81,24 +80,23 @@ management.metrics.export.influx: num-threads: 2 # Number of threads to use with the metrics publishing scheduler. (Default: 2) batch-size: 10000 # Number of measurements per request to use for this backend. If more measurements are found, then multiple requests will be made. (Default: 10000) ``` - Maven dependency: ```xml io.micrometer - micrometer-core - 1.11.2 + micrometer-registry-influx + 1.12.2 ``` or when using with Gradle: ```groovy dependencies { - implementation "io.micrometer:micrometer-core:1.11.2" + implementation "io.micrometer:micrometer-registry-influx:1.7.0" } -``` - +``` + ## Actuator for InfluxDB2 health The `/health` endpoint can monitor an **InfluxDB 2.x** server. diff --git a/spring/pom.xml b/spring/pom.xml index 48192964cf0..386cdbc1fc1 100644 --- a/spring/pom.xml +++ b/spring/pom.xml @@ -73,8 +73,8 @@ 1.12.1 - 2.7.17 - 5.3.26 + 3.2.2 + 6.1.3 @@ -158,7 +158,7 @@ ${mockito.version} test - + org.springframework.boot spring-boot-configuration-processor @@ -168,4 +168,4 @@ - \ No newline at end of file + diff --git a/spring/src/main/java/com/influxdb/spring/health/InfluxDB2HealthIndicatorAutoConfiguration.java b/spring/src/main/java/com/influxdb/spring/health/InfluxDB2HealthIndicatorAutoConfiguration.java index 39d05d6ba9d..58467860b75 100644 --- a/spring/src/main/java/com/influxdb/spring/health/InfluxDB2HealthIndicatorAutoConfiguration.java +++ b/spring/src/main/java/com/influxdb/spring/health/InfluxDB2HealthIndicatorAutoConfiguration.java @@ -50,10 +50,14 @@ public class InfluxDB2HealthIndicatorAutoConfiguration extends CompositeHealthContributorConfiguration { + public InfluxDB2HealthIndicatorAutoConfiguration() { + super(InfluxDB2HealthIndicator::new); + } + @Bean @ConditionalOnMissingBean(name = { "influxDB2HealthIndicator", "influxDB2HealthContributor" }) public HealthContributor influxDbHealthContributor(final Map influxDBClients) { return createContributor(influxDBClients); } -} \ No newline at end of file +} From 843c526b5ee79097a2d8f914dc35f798946bee87 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Mon, 22 Jan 2024 11:02:20 +0100 Subject: [PATCH 02/10] chore: drop support for old JDK, min required JDK is 17 --- .circleci/config.yml | 17 +++++++---------- README.md | 2 +- client-kotlin/pom.xml | 2 +- examples/pom.xml | 4 ++-- karaf/karaf-assembly/pom.xml | 2 +- karaf/karaf-features/pom.xml | 2 +- pom.xml | 13 +++++++------ 7 files changed, 20 insertions(+), 22 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 809c7c5ee77..e5b07abd280 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -109,7 +109,7 @@ jobs: parameters: maven-image: type: string - default: &default-maven-image "cimg/openjdk:8.0" + default: &default-maven-image "cimg/openjdk:17.0" influxdb-image: type: string default: &default-influxdb-image "influxdb:latest" @@ -250,11 +250,6 @@ workflows: - check-dependencies - check-generate-site - check-licenses - - tests-java: - name: jdk-8 - - tests-java: - name: jdk-11 - maven-image: "cimg/openjdk:11.0" - tests-java: name: jdk-17 maven-image: "cimg/openjdk:17.0" @@ -262,7 +257,10 @@ workflows: name: jdk-20 maven-image: "cimg/openjdk:20.0" - tests-java: - name: jdk-8-nightly + name: jdk-21 + maven-image: "cimg/openjdk:21.0" + - tests-java: + name: jdk-17-nightly influxdb-image: "quay.io/influxdb/influxdb:nightly" - tests-java: name: client-backpressure @@ -275,11 +273,10 @@ workflows: - check-dependencies - check-generate-site - check-licenses - - jdk-8 - - jdk-11 - jdk-17 - jdk-20 - - jdk-8-nightly + - jdk-21 + - jdk-17-nightly filters: branches: only: master diff --git a/README.md b/README.md index d78db875c38..c18fdd65957 100644 --- a/README.md +++ b/README.md @@ -393,7 +393,7 @@ public class FluxExample { ## Build Requirements -* Java 1.8+ (tested with jdk8) +* Java 17+ (tested with JDK 17) * Maven 3.0+ (tested with maven 3.5.0) * Docker daemon running * The latest InfluxDB 2.x and InfluxDB 1.X docker instances, which can be started using the `./scripts/influxdb-restart.sh` script diff --git a/client-kotlin/pom.xml b/client-kotlin/pom.xml index b25619df4e8..12fa9bae9b3 100644 --- a/client-kotlin/pom.xml +++ b/client-kotlin/pom.xml @@ -86,7 +86,7 @@ ${kotlin.version} true - 1.8 + 17 diff --git a/examples/pom.xml b/examples/pom.xml index 021c426f517..660121fed85 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -46,7 +46,7 @@ ${kotlin.version} true - 1.8 + 17 @@ -182,4 +182,4 @@ - \ No newline at end of file + diff --git a/karaf/karaf-assembly/pom.xml b/karaf/karaf-assembly/pom.xml index c599a5bf5c5..f030528b50d 100644 --- a/karaf/karaf-assembly/pom.xml +++ b/karaf/karaf-assembly/pom.xml @@ -50,7 +50,7 @@ default-assembly - 1.8 + 17 framework instance diff --git a/karaf/karaf-features/pom.xml b/karaf/karaf-features/pom.xml index cc98038d234..3218ebd75c3 100644 --- a/karaf/karaf-features/pom.xml +++ b/karaf/karaf-features/pom.xml @@ -56,7 +56,7 @@ default-verify - 1.8 + 17 org.apache.karaf.features:framework mvn:org.apache.karaf.features/framework/${karaf.version}/xml/features diff --git a/pom.xml b/pom.xml index 51fdcf21031..68a20b650dc 100644 --- a/pom.xml +++ b/pom.xml @@ -109,7 +109,7 @@ UTF-8 2.9.0 - 4.11.0 + 4.12.0 3.7.0 2.10.1 3.1.8 @@ -138,7 +138,7 @@ - + org.apache.maven.plugins maven-source-plugin @@ -171,8 +171,9 @@ maven-compiler-plugin 3.11.0 - 1.8 - 1.8 + 17 + 17 + 17 @@ -413,7 +414,7 @@ true - + com.mycila license-maven-plugin @@ -739,7 +740,7 @@ kotlinx-coroutines-core-jvm ${kotlin-coroutines.version} - + From fb0afd68af4509826c64c4bdf778e1d7bb471245 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Mon, 22 Jan 2024 11:41:07 +0100 Subject: [PATCH 03/10] fix: dependencies to kotlin stdlib --- client-core/pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/client-core/pom.xml b/client-core/pom.xml index 99844c61900..5f15d13bc6a 100644 --- a/client-core/pom.xml +++ b/client-core/pom.xml @@ -107,10 +107,6 @@ org.jetbrains.kotlin kotlin-stdlib-common - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - From 22370c847f2467d44c85b9af25207259a77e14a4 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Mon, 22 Jan 2024 15:38:52 +0100 Subject: [PATCH 04/10] fix: dependencies --- client-core/pom.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/client-core/pom.xml b/client-core/pom.xml index 5f15d13bc6a..f4487bfb5e5 100644 --- a/client-core/pom.xml +++ b/client-core/pom.xml @@ -98,16 +98,6 @@ com.squareup.okio okio - - - org.jetbrains.kotlin - kotlin-stdlib - - - org.jetbrains.kotlin - kotlin-stdlib-common - - From 1cc76f4e5857144f0fd21003e6bcced8a74ba334 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Tue, 23 Jan 2024 09:01:35 +0100 Subject: [PATCH 05/10] fix: scala version --- client-scala/cross/2.13/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client-scala/cross/2.13/pom.xml b/client-scala/cross/2.13/pom.xml index 3908623cb4a..fdebc016ade 100644 --- a/client-scala/cross/2.13/pom.xml +++ b/client-scala/cross/2.13/pom.xml @@ -72,7 +72,7 @@ - 2.13.9 + 2.13.11 From ecdc8d261f8a2ff1cddedca80d40a68c51813a96 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Mon, 29 Jan 2024 09:09:40 +0100 Subject: [PATCH 06/10] docs: JDK warning --- CHANGELOG.md | 2 ++ README.md | 2 +- spring/README.md | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d548e319adc..4fa95f2faf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## 7.0.0 [unreleased] +:warning: This client version discontinues support for JDK 8 and 11. The minimum supported JDK version is now JDK 17. + :warning: This client version discontinues support for Akka Streams and introduces support for Pekko Streams instead. Apache Pekko is a fork of [Akka](https://github.com/akka/akka) 2.6.x, created after the Akka project adopted the Business Source License, which is not compatible with open-source usage. ### Features diff --git a/README.md b/README.md index c18fdd65957..a8720ed8da7 100644 --- a/README.md +++ b/README.md @@ -394,11 +394,11 @@ public class FluxExample { ## Build Requirements * Java 17+ (tested with JDK 17) + * :warning: If you want to use older version of JDK, you have to use the 6.x version of the client. * Maven 3.0+ (tested with maven 3.5.0) * Docker daemon running * The latest InfluxDB 2.x and InfluxDB 1.X docker instances, which can be started using the `./scripts/influxdb-restart.sh` script - Once these are in place you can build influxdb-client-java with all tests with: diff --git a/spring/README.md b/spring/README.md index a21a8dcc4e5..0f998914b8a 100644 --- a/spring/README.md +++ b/spring/README.md @@ -93,7 +93,7 @@ Maven dependency: or when using with Gradle: ```groovy dependencies { - implementation "io.micrometer:micrometer-registry-influx:1.7.0" + implementation "io.micrometer:micrometer-registry-influx:1.12.2" } ``` From 41e8650d0c909842616f5fcbc80312d7f033e339 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Mon, 29 Jan 2024 09:14:21 +0100 Subject: [PATCH 07/10] docs: libraries changes --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fa95f2faf9..87afb5541ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ ### Features 1. [#661](https://github.com/influxdata/influxdb-client-java/pull/661): Replaced Akka Streams with Pekko Streams in the Scala client. - +1. [#673](https://github.com/influxdata/influxdb-client-java/pull/673): Upgrade SpringBoot to v3 and Spring to v6 +1. [#673](https://github.com/influxdata/influxdb-client-java/pull/673): Disable support for old JDKs (< 17) ### Dependencies @@ -18,6 +19,10 @@ Update dependencies: - [#667](https://github.com/influxdata/influxdb-client-java/pull/667): `rxjava` to `3.1.8` - [#669](https://github.com/influxdata/influxdb-client-java/pull/669): `commons-lang3` to `3.14.0` - [#670](https://github.com/influxdata/influxdb-client-java/pull/670): `micrometer-registry-influx` to `1.12.1` + - [#673](https://github.com/influxdata/influxdb-client-java/pull/673): `spring-boot` to `3.2.2` + - [#673](https://github.com/influxdata/influxdb-client-java/pull/673): `spring` to `6.1.3` + - [#673](https://github.com/influxdata/influxdb-client-java/pull/673): `scala-library` to `2.13.11` + - [#673](https://github.com/influxdata/influxdb-client-java/pull/673): `okhttp` to `4.12.0` #### Maven: - [#671](https://github.com/influxdata/influxdb-client-java/pull/671): `maven-javadoc-plugin` to `3.6.3` From 82547fb6b2e6df75f7d29d69c9c2d7c84188b947 Mon Sep 17 00:00:00 2001 From: karel rehor Date: Mon, 29 Jan 2024 15:22:46 +0100 Subject: [PATCH 08/10] test: fix assert to reenable local build without install --- .../src/test/java/com/influxdb/client/WriteApiTest.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/test/java/com/influxdb/client/WriteApiTest.java b/client/src/test/java/com/influxdb/client/WriteApiTest.java index 853aa7956fe..4f4059e9a3b 100644 --- a/client/src/test/java/com/influxdb/client/WriteApiTest.java +++ b/client/src/test/java/com/influxdb/client/WriteApiTest.java @@ -1012,7 +1012,14 @@ void userAgent() throws InterruptedException { String userAgent = recordedRequest.getHeader("User-Agent"); - Assertions.assertThat(userAgent).startsWith("influxdb-client-java/7."); + String currentVersion = influxDBClient.getClass().getPackage().getImplementationVersion(); + + // not all test situations will get correct version from manifest at this point + String expectVersion = currentVersion == null + ? "unknown" + : currentVersion.substring(0, currentVersion.indexOf(".") + 1); + + Assertions.assertThat(userAgent).startsWith(String.format("influxdb-client-java/%s", expectVersion)); } @Test From 7cd2457cfcbae9750594c5155460bc8f43f74fbe Mon Sep 17 00:00:00 2001 From: karel rehor Date: Mon, 29 Jan 2024 15:30:57 +0100 Subject: [PATCH 09/10] chore: revert previous commit - breaks CI build --- .../src/test/java/com/influxdb/client/WriteApiTest.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/client/src/test/java/com/influxdb/client/WriteApiTest.java b/client/src/test/java/com/influxdb/client/WriteApiTest.java index 4f4059e9a3b..2b7b101e7a6 100644 --- a/client/src/test/java/com/influxdb/client/WriteApiTest.java +++ b/client/src/test/java/com/influxdb/client/WriteApiTest.java @@ -1013,13 +1013,8 @@ void userAgent() throws InterruptedException { String userAgent = recordedRequest.getHeader("User-Agent"); String currentVersion = influxDBClient.getClass().getPackage().getImplementationVersion(); - - // not all test situations will get correct version from manifest at this point - String expectVersion = currentVersion == null - ? "unknown" - : currentVersion.substring(0, currentVersion.indexOf(".") + 1); - - Assertions.assertThat(userAgent).startsWith(String.format("influxdb-client-java/%s", expectVersion)); + + Assertions.assertThat(userAgent).startsWith("influxdb-client-java/7."); } @Test From e4e6b7097aec985d32d6b151b6894303efa2a56e Mon Sep 17 00:00:00 2001 From: karel rehor Date: Mon, 29 Jan 2024 16:15:30 +0100 Subject: [PATCH 10/10] test: fix assert of User-Agent in local builds --- .../test/java/com/influxdb/client/WriteApiTest.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/client/src/test/java/com/influxdb/client/WriteApiTest.java b/client/src/test/java/com/influxdb/client/WriteApiTest.java index 2b7b101e7a6..c79969116f6 100644 --- a/client/src/test/java/com/influxdb/client/WriteApiTest.java +++ b/client/src/test/java/com/influxdb/client/WriteApiTest.java @@ -46,6 +46,7 @@ import com.influxdb.exceptions.RequestEntityTooLargeException; import com.influxdb.exceptions.UnauthorizedException; +import com.influxdb.internal.UserAgentInterceptor; import io.reactivex.rxjava3.schedulers.TestScheduler; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.RecordedRequest; @@ -1012,9 +1013,15 @@ void userAgent() throws InterruptedException { String userAgent = recordedRequest.getHeader("User-Agent"); - String currentVersion = influxDBClient.getClass().getPackage().getImplementationVersion(); - - Assertions.assertThat(userAgent).startsWith("influxdb-client-java/7."); + String currentVersion = UserAgentInterceptor.class.getPackage().getImplementationVersion(); + + // not all test situations will get correct version from manifest at this point + String expectVersion = currentVersion == null + ? "unknown" + : currentVersion.substring(0, currentVersion.indexOf(".") + 1); + + Assertions.assertThat(userAgent).startsWith(String.format("influxdb-client-java/%s", expectVersion)); + } @Test