diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml
index 166f9385a..7a1282c11 100644
--- a/.github/workflows/code-style.yml
+++ b/.github/workflows/code-style.yml
@@ -18,7 +18,7 @@ jobs:
env:
JAVA_DISTRIBUTION: temurin
- JAVA_VERSION: 17
+ JAVA_VERSION: 21
steps:
- name: Checkout repository
@@ -45,7 +45,7 @@ jobs:
env:
JAVA_DISTRIBUTION: temurin
- JAVA_VERSION: 17
+ JAVA_VERSION: 21
steps:
- name: Checkout repository
@@ -72,7 +72,7 @@ jobs:
env:
JAVA_DISTRIBUTION: temurin
- JAVA_VERSION: 17
+ JAVA_VERSION: 21
steps:
- name: Checkout repository
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
index 42d7c902f..5179430e3 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -17,7 +17,7 @@ jobs:
verify:
uses: FAIRDataTeam/github-workflows/.github/workflows/maven-verify.yml@v2
with:
- java-version: 17
+ java-version: 21
# todo: enable tests when test duration has been minimized
mvn-options: "-DskipTests"
publish:
diff --git a/.github/workflows/maven-verify.yml b/.github/workflows/maven-verify.yml
index c6417e646..81c6ba8d4 100644
--- a/.github/workflows/maven-verify.yml
+++ b/.github/workflows/maven-verify.yml
@@ -26,7 +26,7 @@ jobs:
- os: macos-14
mongo: 8
java-version:
- - 17
+ - 21
uses: FAIRDataTeam/github-workflows/.github/workflows/maven-verify.yml@v2
with:
runner: ${{ matrix.runner.os }}
diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml
index fac0979e0..e1789e1c7 100644
--- a/.github/workflows/security.yml
+++ b/.github/workflows/security.yml
@@ -23,7 +23,7 @@ jobs:
env:
JAVA_DISTRIBUTION: temurin
- JAVA_VERSION: 17
+ JAVA_VERSION: 21
steps:
- name: Checkout repository
diff --git a/CHANGELOG.md b/CHANGELOG.md
index afbe87143..401073f7b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Cleaned up Dockerfile (backport)
- Separate Github workflows for test and publish (backport)
+- Upgraded to Java JDK 21 (LTS)
+- Upgraded to latest dependencies
## [1.17.2]
diff --git a/Dockerfile b/Dockerfile
index 9ea7fb113..ec1a9fb2d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,7 +4,7 @@
################################################################################
# BUILD JAR
-FROM maven:3-eclipse-temurin-17-focal AS builder
+FROM maven:3-eclipse-temurin-21-alpine AS builder
WORKDIR /builder
@@ -16,12 +16,11 @@ RUN mvn --quiet --batch-mode --update-snapshots --fail-fast -DskipTests package
################################################################################
# BUILD IMAGE
-FROM eclipse-temurin:17-jdk-focal
+FROM eclipse-temurin:21-jdk-alpine
# add non-root user to run the app
# https://spring.io/guides/gs/spring-boot-docker
-# on ubuntu the following creates a group with the same name as user
-RUN adduser spring --system --group
+RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring
WORKDIR /fdp
diff --git a/README.md b/README.md
index a0c1b9645..f4393b053 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ e.g. [app.fairdatapoint.org/swagger-ui.html](https://app.fairdatapoint.org/swagg
### Technology Stack
-- **Java** (JDK 17)
+- **Java** (JDK 21)
- **MongoDB** (4.2)
- **Maven** (3.2.5 or higher)
- **Docker** (19.03.0-ce or higher) - *for building Docker image only*
diff --git a/pom.xml b/pom.xml
index a1d1cd981..189cbcbdb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.boot
spring-boot-starter-parent
- 3.1.1
+ 3.5.0
nl.dtls
@@ -47,8 +47,8 @@
UTF-8
- 17
- 17
+ 21
+ 21
2.0.0
@@ -56,25 +56,23 @@
6.0.0
- 2.1.0
- 5.3.1
- 4.1.1
- 4.3.2
- 0.11.5
- 1.18.28
+ 2.8.8
+ 5.5.1
+ 5.1.3
+ 0.12.6
- 5.2.1
+ 5.5
- 4.2
+ 5.0.0
0.7.6.201602180812
4.3.0
2.3.1
- 6.0.0
+ 9.0.1
0.2.0
- 3.3.0
- 4.7.3.5
+ 3.6.0
+ 4.9.3.0
@@ -175,7 +173,6 @@
org.springframework.data
spring-data-mongodb
- ${mongodb.spring-data.version}
@@ -228,7 +225,6 @@
org.projectlombok
lombok
- ${lombok.version}
@@ -347,12 +343,12 @@
com.puppycrawl.tools
checkstyle
- 10.12.1
+ 10.24.0
io.spring.javaformat
spring-javaformat-checkstyle
- 0.0.39
+ 0.0.45
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/schema/data/MetadataSchemaFixtures.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/schema/data/MetadataSchemaFixtures.java
index c7af5276c..a0d19b279 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/schema/data/MetadataSchemaFixtures.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/schema/data/MetadataSchemaFixtures.java
@@ -59,6 +59,7 @@ private MetadataSchema createSchemaFixture(
.version(VERSION)
.versionString(VERSION.toString())
.name(name)
+ .description("")
.definition(definition)
.targetClasses(targetClasses)
.extendSchemas(extendsSchemas)
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/jwt/JwtService.java b/src/main/java/nl/dtls/fairdatapoint/service/jwt/JwtService.java
index db1cfe854..611dc25a9 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/jwt/JwtService.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/jwt/JwtService.java
@@ -73,7 +73,7 @@ public class JwtService {
protected void init() {
secretKey = Base64.getEncoder().encodeToString(secretKey.getBytes());
key = new SecretKeySpec(secretKey.getBytes(), SignatureAlgorithm.HS256.getJcaName());
- parser = Jwts.parserBuilder().setSigningKey(key).build();
+ parser = Jwts.parser().setSigningKey(key).build();
}
public String createToken(AuthDTO authDTO) {
@@ -94,13 +94,13 @@ public Authentication getAuthentication(String token) {
}
public String getUserUuid(String token) {
- return parser.parseClaimsJws(token).getBody().getSubject();
+ return parser.parseClaimsJws(token).getPayload().getSubject();
}
public boolean validateToken(String token) {
try {
final Jws claims = parser.parseClaimsJws(token);
- return !claims.getBody().getExpiration().before(new Date());
+ return !claims.getPayload().getExpiration().before(new Date());
}
catch (JwtException | IllegalArgumentException exception) {
throw new UnauthorizedException("Expired or invalid JWT token");
@@ -108,13 +108,13 @@ public boolean validateToken(String token) {
}
private String buildToken(User user) {
- final Claims claims = Jwts.claims().setSubject(user.getUuid());
+ final Claims claims = Jwts.claims().subject(user.getUuid().toString()).build();
final Date now = new Date();
final Date validity = new Date(now.getTime() + (expiration * DAY_MS));
return Jwts.builder()
- .setClaims(claims)
- .setIssuedAt(now)
- .setExpiration(validity)
+ .claims(claims)
+ .issuedAt(now)
+ .expiration(validity)
.signWith(key)
.compact();
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/metadata/state/MetadataStateService.java b/src/main/java/nl/dtls/fairdatapoint/service/metadata/state/MetadataStateService.java
index aa3cf62f1..2c5c37bf7 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/metadata/state/MetadataStateService.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/metadata/state/MetadataStateService.java
@@ -44,7 +44,6 @@
import java.util.stream.Collectors;
import static java.lang.String.format;
-import static nl.dtls.fairdatapoint.entity.metadata.MetadataGetter.getUri;
import static nl.dtls.fairdatapoint.util.RdfUtil.getObjectsBy;
import static nl.dtls.fairdatapoint.util.ValueFactoryHelper.i;
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/openapi/SwaggerUI_GET.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/openapi/SwaggerUI_GET.java
index 65d8b4ee1..8caf7c764 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/openapi/SwaggerUI_GET.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/openapi/SwaggerUI_GET.java
@@ -27,6 +27,7 @@
import nl.dtls.fairdatapoint.utils.CustomPageImpl;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
+import org.springframework.boot.http.client.ClientHttpRequestFactorySettings;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@@ -61,7 +62,8 @@ public void res302_redirectsToSwaggerUI() {
.build();
// WHEN
- ResponseEntity result = client.exchange(request, new ParameterizedTypeReference<>() {});
+ ResponseEntity result = client.withRedirects(ClientHttpRequestFactorySettings.Redirects.DONT_FOLLOW)
+ .exchange(request, new ParameterizedTypeReference<>() {});
// THEN
assertThat("Response code is FOUND", result.getStatusCode(), is(equalTo(HttpStatus.FOUND)));
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/schema/Import_POST.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/schema/Import_POST.java
index 23af7b311..50e7d34a7 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/schema/Import_POST.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/schema/Import_POST.java
@@ -23,7 +23,6 @@
package nl.dtls.fairdatapoint.acceptance.schema;
import nl.dtls.fairdatapoint.WebIntegrationTest;
-import nl.dtls.fairdatapoint.api.dto.schema.MetadataSchemaRemoteDTO;
import nl.dtls.fairdatapoint.api.dto.schema.MetadataSchemaVersionDTO;
import nl.dtls.fairdatapoint.database.mongo.migration.development.schema.data.MetadataSchemaFixtures;
import nl.dtls.fairdatapoint.database.mongo.repository.MetadataSchemaRepository;
@@ -73,6 +72,8 @@ private MetadataSchemaVersionDTO schemaPublicDTO1() {
.description(metadataSchemaFixtures.customSchema().getDescription())
.definition(metadataSchemaFixtures.customSchema().getDefinition())
.abstractSchema(metadataSchemaFixtures.customSchema().isAbstractSchema())
+ .type(metadataSchemaFixtures.customSchema().getType())
+ .targetClasses(metadataSchemaFixtures.customSchema().getTargetClasses())
.extendsSchemaUuids(Collections.emptyList())
.build();
}
@@ -91,6 +92,8 @@ private MetadataSchemaVersionDTO schemaPublicDTO2() {
.description(metadataSchemaFixtures.customSchema().getDescription())
.definition(metadataSchemaFixtures.customSchema().getDefinition())
.abstractSchema(metadataSchemaFixtures.customSchema().isAbstractSchema())
+ .type(metadataSchemaFixtures.customSchema().getType())
+ .targetClasses(metadataSchemaFixtures.customSchema().getTargetClasses())
.extendsSchemaUuids(Collections.emptyList())
.build();
}