Skip to content

Commit

Permalink
feat: upgrade Spring to v6, SpringBoot to v3 (#673)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
bednar and karel-rehor authored Jan 29, 2024
1 parent 50e1142 commit c28b9db
Show file tree
Hide file tree
Showing 15 changed files with 60 additions and 59 deletions.
17 changes: 7 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -250,19 +250,17 @@ 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"
- tests-java:
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
Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
## 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
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

Expand All @@ -16,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`
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,12 @@ public class FluxExample {

## Build Requirements

* Java 1.8+ (tested with jdk8)
* 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:


Expand Down
14 changes: 0 additions & 14 deletions client-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,6 @@
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<exclusions>
<exclusion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</exclusion>
<exclusion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion client-kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<version>${kotlin.version}</version>
<configuration>
<nowarn>true</nowarn>
<jvmTarget>1.8</jvmTarget>
<jvmTarget>17</jvmTarget>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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

@NotNull
@Nonnull
private Consumer<Throwable> onError(final ObservableEmitter<?> subscriber) {
return throwable -> {
if (!subscriber.isDisposed()) {
Expand All @@ -366,4 +365,4 @@ private Consumer<Throwable> onError(final ObservableEmitter<?> subscriber) {
}
};
}
}
}
2 changes: 1 addition & 1 deletion client-scala/cross/2.13/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</scm>

<properties>
<scala.version>2.13.9</scala.version>
<scala.version>2.13.11</scala.version>
</properties>

<build>
Expand Down
11 changes: 10 additions & 1 deletion client/src/test/java/com/influxdb/client/WriteApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1012,7 +1013,15 @@ void userAgent() throws InterruptedException {

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

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
Expand Down
4 changes: 2 additions & 2 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<version>${kotlin.version}</version>
<configuration>
<nowarn>true</nowarn>
<jvmTarget>1.8</jvmTarget>
<jvmTarget>17</jvmTarget>
</configuration>
<executions>
<execution>
Expand Down Expand Up @@ -182,4 +182,4 @@
</repositories>


</project>
</project>
2 changes: 1 addition & 1 deletion karaf/karaf-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<execution>
<id>default-assembly</id>
<configuration>
<javase>1.8</javase>
<javase>17</javase>
<framework>framework</framework>
<bootFeatures>
<feature>instance</feature>
Expand Down
2 changes: 1 addition & 1 deletion karaf/karaf-features/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<execution>
<id>default-verify</id>
<configuration>
<javase>1.8</javase>
<javase>17</javase>
<distribution>org.apache.karaf.features:framework</distribution>
<descriptors>
<descriptor>mvn:org.apache.karaf.features/framework/${karaf.version}/xml/features</descriptor>
Expand Down
13 changes: 7 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<dependency.retrofit.version>2.9.0</dependency.retrofit.version>
<dependency.okhttp3.version>4.11.0</dependency.okhttp3.version>
<dependency.okhttp3.version>4.12.0</dependency.okhttp3.version>
<dependency.com.squareup.okio>3.7.0</dependency.com.squareup.okio>
<dependency.gson.version>2.10.1</dependency.gson.version>
<dependency.io.reactivex.rxjava3>3.1.8</dependency.io.reactivex.rxjava3>
Expand Down Expand Up @@ -138,7 +138,7 @@
<build>

<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down Expand Up @@ -171,8 +171,9 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>17</source>
<release>17</release>
<target>17</target>
</configuration>
</plugin>

Expand Down Expand Up @@ -413,7 +414,7 @@
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>

<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
Expand Down Expand Up @@ -739,7 +740,7 @@
<artifactId>kotlinx-coroutines-core-jvm</artifactId>
<version>${kotlin-coroutines.version}</version>
</dependency>

</dependencies>
</dependencyManagement>

Expand Down
20 changes: 9 additions & 11 deletions spring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<properties>
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<version>1.11.2</version>
<artifactId>micrometer-registry-influx</artifactId>
<version>1.12.2</version>
</dependency>
```

or when using with Gradle:
```groovy
dependencies {
implementation "io.micrometer:micrometer-core:1.11.2"
implementation "io.micrometer:micrometer-registry-influx:1.12.2"
}
```

```
## Actuator for InfluxDB2 health

The `/health` endpoint can monitor an **InfluxDB 2.x** server.
Expand Down
8 changes: 4 additions & 4 deletions spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@

<properties>
<micrometer.version>1.12.1</micrometer.version>
<spring-boot.version>2.7.17</spring-boot.version>
<spring.version>5.3.26</spring.version>
<spring-boot.version>3.2.2</spring-boot.version>
<spring.version>6.1.3</spring.version>
</properties>

<build>
Expand Down Expand Up @@ -158,7 +158,7 @@
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
Expand All @@ -168,4 +168,4 @@

</dependencies>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@
public class InfluxDB2HealthIndicatorAutoConfiguration
extends CompositeHealthContributorConfiguration<InfluxDB2HealthIndicator, InfluxDBClient> {

public InfluxDB2HealthIndicatorAutoConfiguration() {
super(InfluxDB2HealthIndicator::new);
}

@Bean
@ConditionalOnMissingBean(name = { "influxDB2HealthIndicator", "influxDB2HealthContributor" })
public HealthContributor influxDbHealthContributor(final Map<String, InfluxDBClient> influxDBClients) {
return createContributor(influxDBClients);
}

}
}

0 comments on commit c28b9db

Please sign in to comment.