Skip to content

Commit dbaaefa

Browse files
authored
Cleanup and upgrade of the Spring implementations to Spring Boot 3.3 (#9167)
* Upgrade spring test to Spring Boot 3.3.1 This commit also introduces several refinements: - Upgrade to Java 21 with Liberica JRE - Make Message a top level class - Properly exclude autoconfigurations based on profiles - Use Spring Boot 3.3 executable JAR unpack feature - Remove java options enabled by default - Keep debug symbol in JVM bytecode for parameter name resolution * Upgrade spring-webflux test to Spring Boot 3.3.1 This commit also introduces several refinements - Reactivate the test - Remove unmaintained variants to keep only r2dbc and mongo - Upgrade to Spring Boot 3.3.1 - Upgrade to Java 21 with Liberica JRE - Dependency cleanup - Various related updates - Add JSON and textplain endpoints - Properly exclude autoconfigurations based on profiles - Use Spring Boot 3.3 executable JAR unpack feature - Add -Dreactor.netty.http.server.lastFlushWhenNoRead=true property - Keep debug symbol in JVM bytecode for parameter name resolution
1 parent f496311 commit dbaaefa

34 files changed

+148
-814
lines changed

frameworks/Java/spring-webflux/README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@ For mongoDB access, spring-data-mongodb with reactive support is used. See [Mong
3737

3838
* [Template rendering test source](src/main/java/benchmark/web/WebfluxRouter.java)
3939

40-
## Versions
41-
42-
* [Java OpenJDK 10](http://openjdk.java.net/)
43-
* [Spring boot 2.1.0.RELEASE](https://spring.io/projects/spring-boot)
44-
* [Spring data mongodb 2.1.0.RELEASE](https://projects.spring.io/spring-data-mongodb/)
45-
* [reactive-pg-client 0.10.6](https://github.com/reactiverse/reactive-pg-client)
46-
* [rxjava2-jdbc 0.2.0](https://github.com/davidmoten/rxjava2-jdbc)
47-
* [r2dbc-postgresql 1.0.0.BUILD-SNAPSHOT](https://github.com/r2dbc/r2dbc-postgresql)
48-
4940
## Test URLs
5041

5142
### Plaintext Test

frameworks/Java/spring-webflux/benchmark_config.json

Lines changed: 4 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
"framework": "spring-webflux",
33
"tests": [{
44
"default": {
5+
"json_url": "/json",
56
"db_url": "/db",
67
"query_url": "/queries?queries=",
78
"fortune_url": "/fortunes",
9+
"plaintext_url": "/plaintext",
810
"update_url": "/updates?queries=",
911
"port": 8080,
1012
"approach": "Realistic",
@@ -23,9 +25,11 @@
2325
"versus": "spring"
2426
},
2527
"mongo": {
28+
"json_url": "/json",
2629
"db_url": "/db",
2730
"query_url": "/queries?queries=",
2831
"fortune_url": "/fortunes",
32+
"plaintext_url": "/plaintext",
2933
"port": 8080,
3034
"approach": "Realistic",
3135
"classification": "Fullstack",
@@ -41,69 +45,6 @@
4145
"display_name": "spring-webflux-mongo",
4246
"notes": "",
4347
"versus": "spring"
44-
},
45-
"pgclient": {
46-
"db_url": "/db",
47-
"query_url": "/queries?queries=",
48-
"fortune_url": "/fortunes",
49-
"update_url": "/updates?queries=",
50-
"port": 8080,
51-
"approach": "Realistic",
52-
"classification": "Fullstack",
53-
"database": "Postgres",
54-
"framework": "spring",
55-
"language": "Java",
56-
"flavor": "None",
57-
"orm": "Micro",
58-
"platform": "Netty",
59-
"webserver": "None",
60-
"os": "Linux",
61-
"database_os": "Linux",
62-
"display_name": "spring-webflux-pgclient",
63-
"notes": "",
64-
"versus": "spring"
65-
},
66-
"rxjdbc": {
67-
"db_url": "/db",
68-
"query_url": "/queries?queries=",
69-
"fortune_url": "/fortunes",
70-
"update_url": "/updates?queries=",
71-
"port": 8080,
72-
"approach": "Realistic",
73-
"classification": "Fullstack",
74-
"database": "Postgres",
75-
"framework": "spring",
76-
"language": "Java",
77-
"flavor": "None",
78-
"orm": "Micro",
79-
"platform": "Netty",
80-
"webserver": "None",
81-
"os": "Linux",
82-
"database_os": "Linux",
83-
"display_name": "spring-webflux-rxjdbc",
84-
"notes": "",
85-
"versus": "spring"
86-
},
87-
"jdbc": {
88-
"db_url": "/db",
89-
"query_url": "/queries?queries=",
90-
"fortune_url": "/fortunes",
91-
"update_url": "/updates?queries=",
92-
"port": 8080,
93-
"approach": "Realistic",
94-
"classification": "Fullstack",
95-
"database": "Postgres",
96-
"framework": "spring",
97-
"language": "Java",
98-
"flavor": "None",
99-
"orm": "Micro",
100-
"platform": "Netty",
101-
"webserver": "None",
102-
"os": "Linux",
103-
"database_os": "Linux",
104-
"display_name": "spring-webflux-jdbc",
105-
"notes": "",
106-
"versus": "spring"
10748
}
10849
}]
10950
}

frameworks/Java/spring-webflux/config.toml

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,6 @@ platform = "Netty"
1616
webserver = "None"
1717
versus = "spring"
1818

19-
[pgclient]
20-
urls.db = "/db"
21-
urls.query = "/queries?queries="
22-
urls.update = "/updates?queries="
23-
urls.fortune = "/fortunes"
24-
approach = "Realistic"
25-
classification = "Fullstack"
26-
database = "Postgres"
27-
database_os = "Linux"
28-
os = "Linux"
29-
orm = "Micro"
30-
platform = "Netty"
31-
webserver = "None"
32-
versus = "spring"
33-
34-
[jdbc]
35-
urls.db = "/db"
36-
urls.query = "/queries?queries="
37-
urls.update = "/updates?queries="
38-
urls.fortune = "/fortunes"
39-
approach = "Realistic"
40-
classification = "Fullstack"
41-
database = "Postgres"
42-
database_os = "Linux"
43-
os = "Linux"
44-
orm = "Micro"
45-
platform = "Netty"
46-
webserver = "None"
47-
versus = "spring"
48-
4919
[mongo]
5020
urls.db = "/db"
5121
urls.query = "/queries?queries="
@@ -59,18 +29,3 @@ orm = "Full"
5929
platform = "Netty"
6030
webserver = "None"
6131
versus = "spring"
62-
63-
[rxjdbc]
64-
urls.db = "/db"
65-
urls.query = "/queries?queries="
66-
urls.update = "/updates?queries="
67-
urls.fortune = "/fortunes"
68-
approach = "Realistic"
69-
classification = "Fullstack"
70-
database = "Postgres"
71-
database_os = "Linux"
72-
os = "Linux"
73-
orm = "Micro"
74-
platform = "Netty"
75-
webserver = "None"
76-
versus = "spring"

frameworks/Java/spring-webflux/pom.xml

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@
88

99
<groupId>benchmark</groupId>
1010
<artifactId>spring-webflux-benchmark</artifactId>
11-
<version>1.1-SNAPSHOT</version>
11+
<version>1.0-SNAPSHOT</version>
1212

1313
<parent>
1414
<groupId>org.springframework.boot</groupId>
1515
<artifactId>spring-boot-starter-parent</artifactId>
16-
<version>3.3.0</version>
16+
<version>3.3.1</version>
1717
</parent>
1818

1919
<properties>
20-
<java.version>17</java.version>
20+
<maven.compiler.source>21</maven.compiler.source>
21+
<maven.compiler.target>21</maven.compiler.target>
2122
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
22-
<pgclient.version>0.11.4</pgclient.version>
23-
<rxjava2-jdbc.version>0.2.14</rxjava2-jdbc.version>
2423
</properties>
2524

2625
<dependencies>
@@ -30,7 +29,11 @@
3029
</dependency>
3130
<dependency>
3231
<groupId>org.springframework.boot</groupId>
33-
<artifactId>spring-boot-starter-jdbc</artifactId>
32+
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
33+
</dependency>
34+
<dependency>
35+
<groupId>org.postgresql</groupId>
36+
<artifactId>r2dbc-postgresql</artifactId>
3437
</dependency>
3538
<dependency>
3639
<groupId>org.springframework.boot</groupId>
@@ -40,38 +43,6 @@
4043
<groupId>org.springframework.boot</groupId>
4144
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
4245
</dependency>
43-
<dependency>
44-
<groupId>org.postgresql</groupId>
45-
<artifactId>postgresql</artifactId>
46-
</dependency>
47-
<dependency>
48-
<groupId>io.reactiverse</groupId>
49-
<artifactId>reactive-pg-client</artifactId>
50-
<version>${pgclient.version}</version>
51-
</dependency>
52-
<dependency>
53-
<groupId>com.github.davidmoten</groupId>
54-
<artifactId>rxjava2-jdbc</artifactId>
55-
<version>${rxjava2-jdbc.version}</version>
56-
</dependency>
57-
58-
<dependency>
59-
<groupId>org.postgresql</groupId>
60-
<artifactId>r2dbc-postgresql</artifactId>
61-
</dependency>
62-
<dependency>
63-
<groupId>io.r2dbc</groupId>
64-
<artifactId>r2dbc-pool</artifactId>
65-
</dependency>
66-
<dependency>
67-
<groupId>org.springframework.data</groupId>
68-
<artifactId>spring-data-r2dbc</artifactId>
69-
</dependency>
70-
<dependency>
71-
<groupId>org.springframework.boot</groupId>
72-
<artifactId>spring-boot-configuration-processor</artifactId>
73-
<optional>true</optional>
74-
</dependency>
7546
</dependencies>
7647

7748
<build>
@@ -84,9 +55,6 @@
8455
<plugin>
8556
<groupId>org.apache.maven.plugins</groupId>
8657
<artifactId>maven-compiler-plugin</artifactId>
87-
<configuration>
88-
<debug>false</debug>
89-
</configuration>
9058
</plugin>
9159
</plugins>
9260
</build>

frameworks/Java/spring-webflux/spring-webflux-jdbc.dockerfile

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
FROM maven:3.9.6-eclipse-temurin-21 as maven
1+
FROM maven:3.9.5-eclipse-temurin-21 as maven
22
WORKDIR /spring
33
COPY src src
44
COPY pom.xml pom.xml
55
RUN mvn package -q
66

7-
FROM eclipse-temurin:21.0.3_9-jre-jammy
7+
FROM bellsoft/liberica-openjre-debian:21
88
WORKDIR /spring
99
COPY --from=maven /spring/target/spring-webflux-benchmark.jar app.jar
10+
# See https://docs.spring.io/spring-boot/reference/packaging/efficient.html
11+
RUN java -Djarmode=tools -jar app.jar extract
12+
1013

1114
EXPOSE 8080
1215

13-
CMD ["java", "-server", "-XX:+UseNUMA", "-Dlogging.level.root=OFF", "-jar", "app.jar", "--spring.profiles.active=mongo"]
16+
CMD ["java", "-Dlogging.level.root=OFF", "-Dreactor.netty.http.server.lastFlushWhenNoRead=true", "-jar", "app/app.jar", "--spring.profiles.active=mongo"]

frameworks/Java/spring-webflux/spring-webflux-pgclient.dockerfile

Lines changed: 0 additions & 13 deletions
This file was deleted.

frameworks/Java/spring-webflux/spring-webflux-rxjdbc.dockerfile

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
FROM maven:3.9.6-eclipse-temurin-21 as maven
1+
FROM maven:3.9.5-eclipse-temurin-21 as maven
22
WORKDIR /spring
33
COPY src src
44
COPY pom.xml pom.xml
55
RUN mvn package -q
66

7-
FROM eclipse-temurin:21.0.3_9-jre-jammy
7+
FROM bellsoft/liberica-openjre-debian:21
88
WORKDIR /spring
99
COPY --from=maven /spring/target/spring-webflux-benchmark.jar app.jar
10+
# See https://docs.spring.io/spring-boot/reference/packaging/efficient.html
11+
RUN java -Djarmode=tools -jar app.jar extract
1012

1113
EXPOSE 8080
1214

13-
CMD ["java", "-server", "-XX:+UseNUMA", "-Dlogging.level.root=OFF", "-jar", "app.jar", "--spring.profiles.active=r2dbc,postgres"]
15+
CMD ["java", "-Dlogging.level.root=OFF", "-Dreactor.netty.http.server.lastFlushWhenNoRead=true", "-jar", "app/app.jar", "--spring.profiles.active=r2dbc"]
Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,15 @@
11
package benchmark;
22

3-
import java.util.concurrent.Executors;
4-
5-
import org.springframework.beans.factory.annotation.Autowired;
63
import org.springframework.boot.SpringApplication;
74
import org.springframework.boot.autoconfigure.SpringBootApplication;
8-
import org.springframework.boot.context.properties.EnableConfigurationProperties;
9-
import org.springframework.boot.web.reactive.result.view.MustacheViewResolver;
10-
import org.springframework.context.annotation.Bean;
115
import org.springframework.scheduling.annotation.EnableScheduling;
12-
import org.springframework.web.reactive.config.EnableWebFlux;
13-
import org.springframework.web.reactive.config.ViewResolverRegistry;
14-
import org.springframework.web.reactive.config.WebFluxConfigurer;
15-
16-
import reactor.core.scheduler.Scheduler;
17-
import reactor.core.scheduler.Schedulers;
186

197
@SpringBootApplication
20-
@EnableWebFlux
218
@EnableScheduling
22-
@EnableConfigurationProperties
23-
public class App implements WebFluxConfigurer {
24-
25-
@Autowired
26-
private MustacheViewResolver mustacheViewResolver;
9+
public class App {
2710

2811
public static void main(String[] args) {
2912
SpringApplication.run(App.class, args);
3013
}
3114

32-
@Bean
33-
ServerFilter serverFilter() {
34-
return new ServerFilter();
35-
}
36-
37-
@Bean
38-
DateHandler dateHandler() {
39-
return new DateHandler();
40-
}
41-
42-
@Bean
43-
Scheduler ioScheduler() {
44-
return Schedulers.fromExecutor(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2));
45-
}
46-
47-
@Override
48-
public void configureViewResolvers(ViewResolverRegistry registry) {
49-
registry.viewResolver(mustacheViewResolver);
50-
}
51-
5215
}

0 commit comments

Comments
 (0)