Skip to content

Commit cbb592e

Browse files
authored
Chore: upgrade to spring boot 4 (#1925)
* upgrade to spring boot 4 * fix import for jackson 3 * replace explicit spring-retry with builint spring boot features * remove unnecessary workaround * fix tests * more fixes * revert to keep RestTemplateBuilder * fix deprecation * fix tests * fix tests * fix integration test * migrate from jakarta to jspecify annotations * convert to jackson 3, jspecify * add unit test for AuthTokenConverter * replace ObjectMapper with JsonMapper * fix import * replace with jspecify * bump es version * silence missing thymeleaf template location * update .devfile * fix checks --------- Signed-off-by: Thomas Neidhart <thomas.neidhart@eclipse-foundation.org>
1 parent 32950ed commit cbb592e

130 files changed

Lines changed: 1047 additions & 977 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ components:
1717
path: /home/user/.local/
1818
- name: elasticsearch
1919
container:
20-
image: docker.elastic.co/elasticsearch/elasticsearch:8.18.8
20+
image: docker.elastic.co/elasticsearch/elasticsearch:9.2.8
2121
memoryRequest: 256Mi
2222
memoryLimit: 2Gi
2323
cpuRequest: 100m

.gitpod.dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ USER gitpod
1010
RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh \
1111
&& sdk install java 25-tem"
1212

13-
RUN curl https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.7.1-linux-x86_64.tar.gz --output elasticsearch-linux-x86_64.tar.gz \
13+
RUN curl https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-9.2.8-linux-x86_64.tar.gz --output elasticsearch-linux-x86_64.tar.gz \
1414
&& tar -xzf elasticsearch-linux-x86_64.tar.gz \
1515
&& rm elasticsearch-linux-x86_64.tar.gz
16-
ENV ES_HOME="$HOME/elasticsearch-8.7.1"
16+
ENV ES_HOME="$HOME/elasticsearch-9.2.8"

deploy/kubernetes/elasticsearch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
privileged: true
3131
containers:
3232
- name: elasticsearch
33-
image: docker.elastic.co/elasticsearch/elasticsearch:8.18.8
33+
image: docker.elastic.co/elasticsearch/elasticsearch:9.2.8
3434
imagePullPolicy: IfNotPresent
3535
ports:
3636
- name: http

deploy/openshift/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ You can find the deployment YAML configuration in the `openvsx-deployment.yml` f
5151
* `ROUTE_NAME`: The name of the route to access the OpenVSX server (default: internal)
5252
* `NAMESPACE`: The namespace where OpenVSX will be deployed (default: openvsx)
5353
* `POSTGRESQL_IMAGE`: The PostgreSQL image to use for the database (default: image-registry.openshift-image-registry.svc:5000/openshift/postgresql:15-el8)
54-
* `OPENVSX_ELASTICSEARCH_IMAGE`: The image for Elasticsearch (default: docker.elastic.co/elasticsearch/elasticsearch:8.7.1).
54+
* `OPENVSX_ELASTICSEARCH_IMAGE`: The image for Elasticsearch (default: docker.elastic.co/elasticsearch/elasticsearch:9.2.8).
5555
* `OPENVSX_SERVER_IMAGE`: The image for the OpenVSX Server.
5656
* `OPENVSX_CLI_IMAGE`: The image for the OpenVSX CLI.
5757
* `OVSX_PAT_BASE64`: Base64 encoded OVSX personal access token.

deploy/openshift/openvsx-deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ parameters:
375375
displayName: OpenVSX CLI image
376376
description: OpenVSX CLI image to use for the deployment of the OpenVSX CLI
377377
- name: OPENVSX_ELASTICSEARCH_IMAGE
378-
value: docker.elastic.co/elasticsearch/elasticsearch:8.7.1
378+
value: docker.elastic.co/elasticsearch/elasticsearch:9.2.8
379379
displayName: OpenVSX Elasticsearch image
380380
description: OpenVSX Elasticsearch image to use for the deployment of the OpenVSX Elasticsearch
381381
- name: OVSX_PAT_BASE64

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ services:
1616
- debug
1717

1818
elasticsearch:
19-
image: elasticsearch:8.18.8
19+
image: elasticsearch:9.2.8
2020
environment:
2121
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
2222
- xpack.security.enabled=false

server/build.gradle

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ plugins {
1515

1616
def jooqSrcDir = 'src/main/jooq-gen'
1717

18-
ext['junit-jupiter.version'] = libs.versions.junit.get()
18+
//ext['junit-jupiter.version'] = libs.versions.junit.get()
1919

2020
// override spring boot managed versions
2121
// see https://docs.spring.io/spring-boot/gradle-plugin/managing-dependencies.html
2222
// example:
2323
// ext['netty.version'] = '4.1.132.Final'
2424

25-
ext['postgresql.version'] = '42.7.11'
26-
ext['netty.version'] = '4.1.135.Final'
2725
ext['opentelemetry.version'] = '1.63.0'
26+
ext['flyway.version'] = libs.versions.flyway
2827

2928
java {
3029
sourceCompatibility = libs.versions.java.get()
@@ -49,33 +48,18 @@ configurations {
4948
devImplementation.extendsFrom implementation
5049
devRuntimeOnly.extendsFrom runtimeOnly
5150

52-
// exclude commons-logging to avoid runtime warnings like these
53-
// Standard Commons Logging discovery in action with spring-jcl:
54-
// please remove commons-logging.jar from classpath in order to avoid potential conflicts
55-
configureEach {
56-
exclude group: "commons-logging", module: "commons-logging"
57-
}
58-
59-
// Gatling 3.15 requires Netty 4.2.x but Spring Boot's dependency management forces 4.1.x.
60-
// Override all io.netty modules (except tcnative which has its own versioning) on the
61-
// gatling configuration to keep its classpath internally consistent.
62-
matching { it.name.startsWith('gatling') }.configureEach {
63-
resolutionStrategy.eachDependency { details ->
64-
if (details.requested.group == 'io.netty' && !details.requested.name.startsWith('netty-tcnative')) {
65-
details.useVersion '4.2.13.Final'
66-
}
67-
}
68-
}
51+
testImplementation.exclude group: 'com.vaadin.external.google', module: 'android-json'
6952
}
7053

7154
dependencies {
72-
implementation "org.springframework.boot:spring-boot-starter-web"
55+
implementation "org.springframework.boot:spring-boot-starter-webmvc"
7356
implementation "org.springframework.boot:spring-boot-starter-jetty"
7457
modules {
7558
module("org.springframework.boot:spring-boot-starter-tomcat") {
7659
replacedBy("org.springframework.boot:spring-boot-starter-jetty")
7760
}
7861
}
62+
implementation "org.springframework.boot:spring-boot-starter-restclient"
7963
implementation "org.springframework.boot:spring-boot-starter-validation"
8064
implementation "org.springframework.boot:spring-boot-starter-jooq"
8165
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
@@ -84,13 +68,16 @@ dependencies {
8468
implementation "org.springframework.boot:spring-boot-starter-security"
8569
implementation "org.springframework.boot:spring-boot-starter-actuator"
8670
implementation "org.springframework.boot:spring-boot-starter-cache"
87-
implementation "org.springframework.boot:spring-boot-starter-aop"
8871
implementation "org.springframework.boot:spring-boot-starter-mail"
89-
implementation "org.springframework.boot:spring-boot-starter-thymeleaf"
72+
implementation "org.springframework.boot:spring-boot-starter-zipkin"
73+
implementation "org.springframework.boot:spring-boot-security-oauth2-client"
74+
9075
implementation "org.springframework.security:spring-security-oauth2-client"
9176
implementation "org.springframework.security:spring-security-oauth2-jose"
77+
9278
implementation "org.springframework.session:spring-session-jdbc"
93-
implementation "org.springframework.retry:spring-retry"
79+
80+
implementation "org.springframework.boot:spring-boot-thymeleaf"
9481

9582
implementation "org.apache.httpcomponents.client5:httpclient5"
9683
implementation "com.github.ben-manes.caffeine:caffeine"
@@ -110,6 +97,7 @@ dependencies {
11097

11198
implementation libs.jobrunr.spring
11299

100+
implementation "org.springframework.boot:spring-boot-flyway"
113101
implementation libs.flyway.core
114102
implementation libs.flyway.database.postgresql
115103

@@ -120,12 +108,8 @@ dependencies {
120108

121109
implementation libs.springdoc
122110

123-
implementation libs.jackson.core
124-
implementation libs.jackson.annotations
125-
implementation libs.jackson.databind
126-
implementation libs.jackson.jaxb.annotations
127-
implementation libs.jackson.dataformat.xml
128111
implementation libs.jackson.dataformat.yaml
112+
implementation libs.jackson.dataformat.xml
129113
implementation libs.jackson.dataformat.toml
130114

131115
implementation libs.woodstox.core
@@ -142,19 +126,22 @@ dependencies {
142126
runtimeOnly "org.postgresql:postgresql"
143127
jooqCodegen "org.postgresql:postgresql"
144128

129+
// to aid migration from 3.5 to 4.0
130+
runtimeOnly "org.springframework.boot:spring-boot-properties-migrator"
131+
145132
devRuntimeOnly "org.springframework.boot:spring-boot-devtools"
146133

147134
testImplementation("org.springframework.boot:spring-boot-starter-test") {
148135
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
149136
}
137+
testImplementation "org.springframework.boot:spring-boot-starter-webmvc-test"
150138
testImplementation "org.springframework.security:spring-security-test"
151-
testImplementation libs.junit.jupiter.api
139+
140+
testImplementation "org.springframework.boot:spring-boot-testcontainers"
152141
testImplementation libs.testcontainers.elasticsearch
153142
testImplementation libs.testcontainers.localstack
154143
testImplementation libs.testcontainers.junit.jupiter
155-
156-
testRuntimeOnly libs.junit.jupiter.engine
157-
testRuntimeOnly libs.testcontainers.postgresql
144+
testImplementation libs.testcontainers.postgresql
158145

159146
gatling libs.gatling.core
160147
gatling libs.gatling.app
@@ -202,7 +189,7 @@ jooq {
202189
}
203190

204191
rewrite {
205-
activeRecipe("org.openrewrite.java.migrate.jakarta.JavaxAnnotationMigrationToJakartaAnnotation")
192+
activeRecipe("org.openrewrite.java.jspecify.MigrateFromJakartaAnnotationApi")
206193
setExportDatatables(true)
207194
}
208195

server/gradle/libs.versions.toml

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,31 @@ commons-lang3 = "3.20.0"
88
flyway = "11.20.3"
99
gatling = "3.15.0"
1010
gcloud = "2.62.1"
11-
hibernate = "6.6.42.Final"
1211
ipaddress = "5.5.1"
13-
jackson = "2.18.8"
1412
java = "25"
1513
jaxb-api = "2.3.1"
1614
jaxb-impl = "2.3.8"
1715
jedis = "7.4.1"
18-
jobrunr = "7.5.3"
16+
jobrunr = "8.6.1"
1917
jooq = "3.19.34"
2018
jsonpath = "2.9.0"
21-
junit = "5.14.2"
2219
loki4j = "1.4.2"
2320
re2j = "1.7"
24-
rewrite-java = "3.26.0"
25-
spring-boot = "3.5.14"
21+
rewrite-java = "3.38.0"
22+
spring-boot = "4.0.7"
2623
springdoc = "2.8.13"
27-
testcontainers = "1.21.4"
2824
tika = "3.3.1"
2925
woodstox = "6.4.0"
3026

3127
[plugins]
3228
download = { id = "de.undercouch.download", version = "5.7.0" }
3329
gatling = { id = "io.gatling.gradle", version.ref = "gatling" }
34-
hibernate-orm = { id = "org.hibernate.orm", version.ref = "hibernate" }
30+
hibernate-orm = { id = "org.hibernate.orm" }
3531
jooq-codegen = { id = "org.jooq.jooq-codegen-gradle", version.ref = "jooq" }
3632
spring-boot = { id = "org.springframework.boot", version.ref = "spring-boot"}
3733
spring-dependency-management = { id = "io.spring.dependency-management", version = "1.1.7" }
3834
test-logger = { id = "com.adarshr.test-logger", version = "4.0.0" }
39-
rewrite = { id = "org.openrewrite.rewrite", version = "7.25.0" }
35+
rewrite = { id = "org.openrewrite.rewrite", version = "7.35.0" }
4036

4137
[libraries]
4238
awssdk-s3 = { module = "software.amazon.awssdk:s3", version.ref = "aws" }
@@ -51,28 +47,22 @@ flyway-database-postgresql = { module = "org.flywaydb:flyway-database-postgres
5147
gatling-app = { module = "io.gatling:gatling-app", version.ref = "gatling" }
5248
gatling-core = { module = "io.gatling:gatling-core", version.ref = "gatling" }
5349
google-cloud-storage = { module = "com.google.cloud:google-cloud-storage", version.ref = "gcloud" }
54-
ipaddress = { module = "com.github.seancfoley:ipaddress", version.ref = "ipaddress"}
55-
jackson-annotations = { module = "com.fasterxml.jackson.core:jackson-annotations", version.ref = "jackson" }
56-
jackson-core = { module = "com.fasterxml.jackson.core:jackson-core", version.ref = "jackson" }
57-
jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }
58-
jackson-dataformat-toml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-toml", version.ref = "jackson" }
59-
jackson-dataformat-xml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-xml", version.ref = "jackson" }
60-
jackson-dataformat-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version.ref = "jackson" }
61-
jackson-jaxb-annotations = { module = "com.fasterxml.jackson.module:jackson-module-jaxb-annotations", version.ref = "jackson" }
50+
ipaddress = { module = "com.github.seancfoley:ipaddress", version.ref = "ipaddress" }
51+
jackson-dataformat-yaml = { module = "tools.jackson.dataformat:jackson-dataformat-yaml" }
52+
jackson-dataformat-xml = { module = "tools.jackson.dataformat:jackson-dataformat-xml" }
53+
jackson-dataformat-toml = { module = "tools.jackson.dataformat:jackson-dataformat-toml" }
6254
jaxb-api = { module = "javax.xml.bind:jaxb-api", version.ref = "jaxb-api" }
6355
jaxb-impl = { module = "com.sun.xml.bind:jaxb-impl", version.ref = "jaxb-impl" }
6456
jedis = { module = "redis.clients:jedis", version.ref = "jedis" }
65-
jobrunr-spring = { module = "org.jobrunr:jobrunr-spring-boot-3-starter", version.ref = "jobrunr" }
57+
jobrunr-spring = { module = "org.jobrunr:jobrunr-spring-boot-4-starter", version.ref = "jobrunr" }
6658
json-path = { module = "com.jayway.jsonpath:json-path", version.ref = "jsonpath" }
67-
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }
68-
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" }
6959
loki-logback-appender = { module = "com.github.loki4j:loki-logback-appender", version.ref = "loki4j" }
7060
re2j = { module = "com.google.re2j:re2j", version.ref = "re2j" }
7161
rewrite-java = { module = "org.openrewrite.recipe:rewrite-migrate-java", version.ref = "rewrite-java"}
7262
springdoc = { module = "org.springdoc:springdoc-openapi-starter-webmvc-ui", version.ref = "springdoc" }
73-
testcontainers-elasticsearch = { module = "org.testcontainers:elasticsearch", version.ref = "testcontainers" }
74-
testcontainers-junit-jupiter = { module = "org.testcontainers:junit-jupiter", version.ref = "testcontainers" }
75-
testcontainers-localstack = { module = "org.testcontainers:localstack", version.ref = "testcontainers" }
76-
testcontainers-postgresql = { module = "org.testcontainers:postgresql", version.ref = "testcontainers" }
63+
testcontainers-elasticsearch = { module = "org.testcontainers:testcontainers-elasticsearch" }
64+
testcontainers-junit-jupiter = { module = "org.testcontainers:testcontainers-junit-jupiter" }
65+
testcontainers-localstack = { module = "org.testcontainers:testcontainers-localstack" }
66+
testcontainers-postgresql = { module = "org.testcontainers:testcontainers-postgresql" }
7767
tika-core = { module = "org.apache.tika:tika-core", version.ref = "tika" }
7868
woodstox-core = { module = "com.fasterxml.woodstox:woodstox-core", version.ref = "woodstox" }

server/settings.gradle

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,38 @@
1+
import groovy.xml.XmlSlurper
2+
3+
pluginManagement {
4+
repositories {
5+
gradlePluginPortal()
6+
mavenCentral()
7+
}
8+
resolutionStrategy {
9+
eachPlugin {
10+
// Supply the Hibernate ORM plugin version from Spring Boot's BOM so it is
11+
// always kept in sync with the managed hibernate-core dependency.
12+
if (requested.id.id == 'org.hibernate.orm') {
13+
useVersion(gradle.ext.hibernateOrmVersion)
14+
}
15+
}
16+
}
17+
}
18+
119
rootProject.name = 'openvsx-server'
20+
21+
buildscript {
22+
repositories {
23+
mavenCentral()
24+
}
25+
}
26+
27+
// Read the Spring Boot version from the version catalog file
28+
def tomlText = file("gradle/libs.versions.toml").text
29+
def springBootVersion = (tomlText =~ /(?m)^spring-boot\s*=\s*"([^"]+)"/).collect { it[1] }.first()
30+
31+
// Resolve the Spring Boot BOM POM and extract the Hibernate ORM version it manages.
32+
// The BOM uses Maven property placeholders (e.g. ${hibernate.version}) in
33+
// <dependencyManagement>, so we read the resolved value from <properties> directly.
34+
def bomPomFile = buildscript.configurations.detachedConfiguration(
35+
buildscript.dependencies.create("org.springframework.boot:spring-boot-dependencies:${springBootVersion}@pom")
36+
).singleFile
37+
def bomPom = new XmlSlurper().parse(bomPomFile)
38+
gradle.ext.hibernateOrmVersion = bomPom.properties['hibernate.version'].text()

server/src/dev/resources/application.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ spring:
1313
name: openvsx-server
1414
autoconfigure:
1515
# don't send traces to Zipkin in development
16-
exclude: org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinAutoConfiguration
16+
exclude: org.springframework.boot.zipkin.autoconfigure.ZipkinAutoConfiguration
1717
profiles:
1818
include: ovsx
1919
# connect to redis cluster configured in docker-compose.yml
@@ -40,8 +40,7 @@ spring:
4040
jdbc:
4141
initialize-schema: never
4242
thymeleaf:
43-
# explicitly disable thymeleaf view resolution
44-
enabled: false
43+
check-template-location: false
4544

4645
# mail:
4746
# host: "localhost"

0 commit comments

Comments
 (0)