Skip to content

Commit c28b9db

Browse files
bednarkarel-rehor
andauthored
feat: upgrade Spring to v6, SpringBoot to v3 (#673)
* feat: upgrade Spring to v6, SpringBoot to v3 * chore: drop support for old JDK, min required JDK is 17 * fix: dependencies to kotlin stdlib * fix: dependencies * fix: scala version * docs: JDK warning * docs: libraries changes * test: fix assert to reenable local build without install * chore: revert previous commit - breaks CI build * test: fix assert of User-Agent in local builds --------- Co-authored-by: karel rehor <[email protected]>
1 parent 50e1142 commit c28b9db

File tree

15 files changed

+60
-59
lines changed

15 files changed

+60
-59
lines changed

.circleci/config.yml

+7-10
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
parameters:
110110
maven-image:
111111
type: string
112-
default: &default-maven-image "cimg/openjdk:8.0"
112+
default: &default-maven-image "cimg/openjdk:17.0"
113113
influxdb-image:
114114
type: string
115115
default: &default-influxdb-image "influxdb:latest"
@@ -250,19 +250,17 @@ workflows:
250250
- check-dependencies
251251
- check-generate-site
252252
- check-licenses
253-
- tests-java:
254-
name: jdk-8
255-
- tests-java:
256-
name: jdk-11
257-
maven-image: "cimg/openjdk:11.0"
258253
- tests-java:
259254
name: jdk-17
260255
maven-image: "cimg/openjdk:17.0"
261256
- tests-java:
262257
name: jdk-20
263258
maven-image: "cimg/openjdk:20.0"
264259
- tests-java:
265-
name: jdk-8-nightly
260+
name: jdk-21
261+
maven-image: "cimg/openjdk:21.0"
262+
- tests-java:
263+
name: jdk-17-nightly
266264
influxdb-image: "quay.io/influxdb/influxdb:nightly"
267265
- tests-java:
268266
name: client-backpressure
@@ -275,11 +273,10 @@ workflows:
275273
- check-dependencies
276274
- check-generate-site
277275
- check-licenses
278-
- jdk-8
279-
- jdk-11
280276
- jdk-17
281277
- jdk-20
282-
- jdk-8-nightly
278+
- jdk-21
279+
- jdk-17-nightly
283280
filters:
284281
branches:
285282
only: master

CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
## 7.0.0 [unreleased]
22

3+
:warning: This client version discontinues support for JDK 8 and 11. The minimum supported JDK version is now JDK 17.
4+
35
: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.
46

57
### Features
68
1. [#661](https://github.com/influxdata/influxdb-client-java/pull/661): Replaced Akka Streams with Pekko Streams in the Scala client.
7-
9+
1. [#673](https://github.com/influxdata/influxdb-client-java/pull/673): Upgrade SpringBoot to v3 and Spring to v6
10+
1. [#673](https://github.com/influxdata/influxdb-client-java/pull/673): Disable support for old JDKs (< 17)
811

912
### Dependencies
1013

@@ -16,6 +19,10 @@ Update dependencies:
1619
- [#667](https://github.com/influxdata/influxdb-client-java/pull/667): `rxjava` to `3.1.8`
1720
- [#669](https://github.com/influxdata/influxdb-client-java/pull/669): `commons-lang3` to `3.14.0`
1821
- [#670](https://github.com/influxdata/influxdb-client-java/pull/670): `micrometer-registry-influx` to `1.12.1`
22+
- [#673](https://github.com/influxdata/influxdb-client-java/pull/673): `spring-boot` to `3.2.2`
23+
- [#673](https://github.com/influxdata/influxdb-client-java/pull/673): `spring` to `6.1.3`
24+
- [#673](https://github.com/influxdata/influxdb-client-java/pull/673): `scala-library` to `2.13.11`
25+
- [#673](https://github.com/influxdata/influxdb-client-java/pull/673): `okhttp` to `4.12.0`
1926

2027
#### Maven:
2128
- [#671](https://github.com/influxdata/influxdb-client-java/pull/671): `maven-javadoc-plugin` to `3.6.3`

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,12 @@ public class FluxExample {
393393

394394
## Build Requirements
395395

396-
* Java 1.8+ (tested with jdk8)
396+
* Java 17+ (tested with JDK 17)
397+
* :warning: If you want to use older version of JDK, you have to use the 6.x version of the client.
397398
* Maven 3.0+ (tested with maven 3.5.0)
398399
* Docker daemon running
399400
* The latest InfluxDB 2.x and InfluxDB 1.X docker instances, which can be started using the `./scripts/influxdb-restart.sh` script
400401

401-
402402
Once these are in place you can build influxdb-client-java with all tests with:
403403

404404

client-core/pom.xml

-14
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,6 @@
9898
<dependency>
9999
<groupId>com.squareup.okio</groupId>
100100
<artifactId>okio</artifactId>
101-
<exclusions>
102-
<exclusion>
103-
<groupId>org.jetbrains.kotlin</groupId>
104-
<artifactId>kotlin-stdlib</artifactId>
105-
</exclusion>
106-
<exclusion>
107-
<groupId>org.jetbrains.kotlin</groupId>
108-
<artifactId>kotlin-stdlib-common</artifactId>
109-
</exclusion>
110-
<exclusion>
111-
<groupId>org.jetbrains.kotlin</groupId>
112-
<artifactId>kotlin-stdlib-jdk8</artifactId>
113-
</exclusion>
114-
</exclusions>
115101
</dependency>
116102

117103
<dependency>

client-kotlin/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<version>${kotlin.version}</version>
8787
<configuration>
8888
<nowarn>true</nowarn>
89-
<jvmTarget>1.8</jvmTarget>
89+
<jvmTarget>17</jvmTarget>
9090
</configuration>
9191
<executions>
9292
<execution>

client-reactive/src/main/java/com/influxdb/client/reactive/internal/QueryReactiveApiImpl.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import io.reactivex.rxjava3.core.Flowable;
4545
import io.reactivex.rxjava3.core.Observable;
4646
import io.reactivex.rxjava3.core.ObservableEmitter;
47-
import org.jetbrains.annotations.NotNull;
4847
import org.reactivestreams.Publisher;
4948

5049
/**
@@ -355,7 +354,7 @@ public Publisher<String> queryRaw(@Nonnull final Publisher<String> queryStream,
355354
.map(q -> new Query().query(q).dialect(dialect)), dialect, org);
356355
}
357356

358-
@NotNull
357+
@Nonnull
359358
private Consumer<Throwable> onError(final ObservableEmitter<?> subscriber) {
360359
return throwable -> {
361360
if (!subscriber.isDisposed()) {
@@ -366,4 +365,4 @@ private Consumer<Throwable> onError(final ObservableEmitter<?> subscriber) {
366365
}
367366
};
368367
}
369-
}
368+
}

client-scala/cross/2.13/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
</scm>
7373

7474
<properties>
75-
<scala.version>2.13.9</scala.version>
75+
<scala.version>2.13.11</scala.version>
7676
</properties>
7777

7878
<build>

client/src/test/java/com/influxdb/client/WriteApiTest.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import com.influxdb.exceptions.RequestEntityTooLargeException;
4747
import com.influxdb.exceptions.UnauthorizedException;
4848

49+
import com.influxdb.internal.UserAgentInterceptor;
4950
import io.reactivex.rxjava3.schedulers.TestScheduler;
5051
import okhttp3.mockwebserver.MockResponse;
5152
import okhttp3.mockwebserver.RecordedRequest;
@@ -1012,7 +1013,15 @@ void userAgent() throws InterruptedException {
10121013

10131014
String userAgent = recordedRequest.getHeader("User-Agent");
10141015

1015-
Assertions.assertThat(userAgent).startsWith("influxdb-client-java/7.");
1016+
String currentVersion = UserAgentInterceptor.class.getPackage().getImplementationVersion();
1017+
1018+
// not all test situations will get correct version from manifest at this point
1019+
String expectVersion = currentVersion == null
1020+
? "unknown"
1021+
: currentVersion.substring(0, currentVersion.indexOf(".") + 1);
1022+
1023+
Assertions.assertThat(userAgent).startsWith(String.format("influxdb-client-java/%s", expectVersion));
1024+
10161025
}
10171026

10181027
@Test

examples/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<version>${kotlin.version}</version>
4747
<configuration>
4848
<nowarn>true</nowarn>
49-
<jvmTarget>1.8</jvmTarget>
49+
<jvmTarget>17</jvmTarget>
5050
</configuration>
5151
<executions>
5252
<execution>
@@ -182,4 +182,4 @@
182182
</repositories>
183183

184184

185-
</project>
185+
</project>

karaf/karaf-assembly/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<execution>
5151
<id>default-assembly</id>
5252
<configuration>
53-
<javase>1.8</javase>
53+
<javase>17</javase>
5454
<framework>framework</framework>
5555
<bootFeatures>
5656
<feature>instance</feature>

karaf/karaf-features/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<execution>
5757
<id>default-verify</id>
5858
<configuration>
59-
<javase>1.8</javase>
59+
<javase>17</javase>
6060
<distribution>org.apache.karaf.features:framework</distribution>
6161
<descriptors>
6262
<descriptor>mvn:org.apache.karaf.features/framework/${karaf.version}/xml/features</descriptor>

pom.xml

+7-6
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
110110

111111
<dependency.retrofit.version>2.9.0</dependency.retrofit.version>
112-
<dependency.okhttp3.version>4.11.0</dependency.okhttp3.version>
112+
<dependency.okhttp3.version>4.12.0</dependency.okhttp3.version>
113113
<dependency.com.squareup.okio>3.7.0</dependency.com.squareup.okio>
114114
<dependency.gson.version>2.10.1</dependency.gson.version>
115115
<dependency.io.reactivex.rxjava3>3.1.8</dependency.io.reactivex.rxjava3>
@@ -138,7 +138,7 @@
138138
<build>
139139

140140
<plugins>
141-
141+
142142
<plugin>
143143
<groupId>org.apache.maven.plugins</groupId>
144144
<artifactId>maven-source-plugin</artifactId>
@@ -171,8 +171,9 @@
171171
<artifactId>maven-compiler-plugin</artifactId>
172172
<version>3.11.0</version>
173173
<configuration>
174-
<source>1.8</source>
175-
<target>1.8</target>
174+
<source>17</source>
175+
<release>17</release>
176+
<target>17</target>
176177
</configuration>
177178
</plugin>
178179

@@ -413,7 +414,7 @@
413414
<autoReleaseAfterClose>true</autoReleaseAfterClose>
414415
</configuration>
415416
</plugin>
416-
417+
417418
<plugin>
418419
<groupId>com.mycila</groupId>
419420
<artifactId>license-maven-plugin</artifactId>
@@ -739,7 +740,7 @@
739740
<artifactId>kotlinx-coroutines-core-jvm</artifactId>
740741
<version>${kotlin-coroutines.version}</version>
741742
</dependency>
742-
743+
743744
</dependencies>
744745
</dependencyManagement>
745746

spring/README.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010

1111
## Spring Boot Compatibility
1212

13-
: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).
13+
: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).
1414

15-
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).
16-
For the older version of `spring-boot` you have to configure Spring Boot's `okhttp3.version` property:
15+
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:
1716

1817
```xml
1918
<properties>
@@ -43,7 +42,7 @@ influx:
4342
connectTimeout: 5s # Connection timeout for OkHttpClient. (Default: 10s)
4443
```
4544
46-
:warning: If you are using a version of Spring Boot prior to 2.7, auto-configuration will not take effect.
45+
: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.
4746
You need to add the `@ComponentScan` annotation to your Spring Boot startup class and include com.influxdb.spring.influx in the basePackages.
4847
For example:
4948
```java
@@ -62,7 +61,7 @@ If you want to configure the `InfluxDBClientReactive` client, you need to includ
6261

6362
## Actuator for InfluxDB2 micrometer registry
6463

65-
To enable export metrics to **InfluxDB 2.x** you need to include `micrometer-core` on your classpath.
64+
To enable export metrics to **InfluxDB 2.x** you need to include `micrometer-registry-influx` on your classpath.
6665
(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.)
6766

6867
The default configuration can be override via properties:
@@ -81,24 +80,23 @@ management.metrics.export.influx:
8180
num-threads: 2 # Number of threads to use with the metrics publishing scheduler. (Default: 2)
8281
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)
8382
```
84-
8583
Maven dependency:
8684

8785
```xml
8886
<dependency>
8987
<groupId>io.micrometer</groupId>
90-
<artifactId>micrometer-core</artifactId>
91-
<version>1.11.2</version>
88+
<artifactId>micrometer-registry-influx</artifactId>
89+
<version>1.12.2</version>
9290
</dependency>
9391
```
9492

9593
or when using with Gradle:
9694
```groovy
9795
dependencies {
98-
implementation "io.micrometer:micrometer-core:1.11.2"
96+
implementation "io.micrometer:micrometer-registry-influx:1.12.2"
9997
}
100-
```
101-
98+
```
99+
102100
## Actuator for InfluxDB2 health
103101

104102
The `/health` endpoint can monitor an **InfluxDB 2.x** server.

spring/pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373

7474
<properties>
7575
<micrometer.version>1.12.1</micrometer.version>
76-
<spring-boot.version>2.7.17</spring-boot.version>
77-
<spring.version>5.3.26</spring.version>
76+
<spring-boot.version>3.2.2</spring-boot.version>
77+
<spring.version>6.1.3</spring.version>
7878
</properties>
7979

8080
<build>
@@ -158,7 +158,7 @@
158158
<version>${mockito.version}</version>
159159
<scope>test</scope>
160160
</dependency>
161-
161+
162162
<dependency>
163163
<groupId>org.springframework.boot</groupId>
164164
<artifactId>spring-boot-configuration-processor</artifactId>
@@ -168,4 +168,4 @@
168168

169169
</dependencies>
170170

171-
</project>
171+
</project>

spring/src/main/java/com/influxdb/spring/health/InfluxDB2HealthIndicatorAutoConfiguration.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,14 @@
5050
public class InfluxDB2HealthIndicatorAutoConfiguration
5151
extends CompositeHealthContributorConfiguration<InfluxDB2HealthIndicator, InfluxDBClient> {
5252

53+
public InfluxDB2HealthIndicatorAutoConfiguration() {
54+
super(InfluxDB2HealthIndicator::new);
55+
}
56+
5357
@Bean
5458
@ConditionalOnMissingBean(name = { "influxDB2HealthIndicator", "influxDB2HealthContributor" })
5559
public HealthContributor influxDbHealthContributor(final Map<String, InfluxDBClient> influxDBClients) {
5660
return createContributor(influxDBClients);
5761
}
5862

59-
}
63+
}

0 commit comments

Comments
 (0)