Upgrade to Spring Boot 3.

Closes #66
This commit is contained in:
Mark Paluch
2025-06-13 13:57:26 +02:00
parent 1ce35db775
commit 9472418743
9 changed files with 57 additions and 54 deletions

24
pom.xml
View File

@@ -9,12 +9,12 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.6</version>
<version>3.5.0</version>
</parent>
<properties>
<spring-plugin.version>2.0.0.RELEASE</spring-plugin.version>
<lombok.version>1.18.26</lombok.version>
<lombok.version>1.18.38</lombok.version>
</properties>
<dependencyManagement>
@@ -105,20 +105,20 @@
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.15.3</version>
<version>1.20.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.1-jre</version>
<version>33.4.8-jre</version>
</dependency>
<dependency>
@@ -159,25 +159,25 @@
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-invoker</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-core</artifactId>
<version>0.9.1</version>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<version>2.27.2</version>
<version>3.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>test</scope>
</dependency>

View File

@@ -36,15 +36,14 @@ import java.util.function.Supplier;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import javax.annotation.PreDestroy;
import org.apache.commons.io.IOUtils;
import org.springframework.data.release.infra.InfrastructureOperations;
import org.springframework.data.release.io.Workspace;
import org.springframework.data.release.model.JavaVersion;
import org.springframework.data.release.model.Project;
import org.springframework.data.release.model.SupportedProject;
import org.springframework.data.release.model.ProjectAware;
import org.springframework.data.release.model.SupportedProject;
import org.springframework.data.release.utils.ListWrapperCollector;
import org.springframework.data.util.Streamable;
import org.springframework.plugin.core.PluginRegistry;
@@ -64,11 +63,6 @@ class BuildExecutor {
private final ExecutorService executor;
private final Workspace workspace;
@PreDestroy
public void shutdown() {
executor.shutdown();
}
/**
* Selects the build system for each module contained in the given iteration and executes the given function for it
* considering pre-requites, honoring the order.
@@ -155,8 +149,7 @@ class BuildExecutor {
.collect(toSummaryCollector());
}
private <T, M extends ProjectAware> CompletableFuture<T> run(M module,
BiFunction<BuildSystem, M, T> function) {
private <T, M extends ProjectAware> CompletableFuture<T> run(M module, BiFunction<BuildSystem, M, T> function) {
Assert.notNull(module, "Module must not be null!");

View File

@@ -30,6 +30,7 @@ import java.util.stream.Collectors;
import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.Ansi.Color;
import org.springframework.data.release.CliComponent;
import org.springframework.data.release.TimedCommand;
import org.springframework.data.release.build.BuildOperations;
@@ -44,7 +45,7 @@ import org.springframework.data.release.model.TrainIteration;
import org.springframework.data.release.utils.ExecutionUtils;
import org.springframework.data.release.utils.Logger;
import org.springframework.data.util.Streamable;
import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.shell.support.table.Table;
@@ -168,7 +169,7 @@ public class DocumentationCommands extends TimedCommand {
.thenComparing(CheckedLink::getUrl)).forEach(checkedLink -> {
Ansi ansi = Ansi.ansi();
HttpStatus status = checkedLink.getResult();
HttpStatusCode status = checkedLink.getResult();
if (status.is2xxSuccessful()) {
ansi.fg(Color.GREEN);
} else if (status.is4xxClientError()) {

View File

@@ -40,6 +40,7 @@ import org.jsoup.select.Elements;
import org.springframework.data.release.model.Project;
import org.springframework.data.release.utils.Logger;
import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.client.WebClient;
@@ -86,7 +87,7 @@ class DocumentationOperations {
return new ReportFlags(set);
}
public boolean isIncluded(HttpStatus status) {
public boolean isIncluded(HttpStatusCode status) {
if (flags.contains(ReportFlag.ALL)) {
return true;
@@ -125,7 +126,7 @@ class DocumentationOperations {
return new PageStats(project, linkStats.filter(reportFlags));
}
public PageStats sort(Comparator<CheckedLink> comparator){
public PageStats sort(Comparator<CheckedLink> comparator) {
return new PageStats(project, linkStats.sort(comparator));
}
@@ -150,7 +151,7 @@ class DocumentationOperations {
public LinkStats filter(ReportFlags reportFlags) {
List<CheckedLink> filtered = checkedLinks.stream().filter(entry -> {
HttpStatus status = entry.getResult();
HttpStatusCode status = entry.getResult();
return reportFlags.isIncluded(status);
}).collect(Collectors.toList());
@@ -168,7 +169,7 @@ class DocumentationOperations {
@Value
static class CheckedLink {
String url;
HttpStatus result;
HttpStatusCode result;
}
@RequiredArgsConstructor
@@ -198,7 +199,7 @@ class DocumentationOperations {
logger.log(project, "Found %s links.", links.size());
Map<String, CompletableFuture<HttpStatus>> resultMap = new LinkedHashMap<>(200);
Map<String, CompletableFuture<HttpStatusCode>> resultMap = new LinkedHashMap<>(200);
links.forEach(link -> {
String href = link.attr("href");
@@ -224,7 +225,7 @@ class DocumentationOperations {
return stats;
}
private void checkUrl(Map<String, CompletableFuture<HttpStatus>> resultMap, String url) {
private void checkUrl(Map<String, CompletableFuture<HttpStatusCode>> resultMap, String url) {
resultMap.computeIfAbsent(url, key -> webClient.get().uri(url)
.exchangeToMono(clientResponse -> clientResponse.toBodilessEntity().thenReturn(clientResponse.statusCode()))

View File

@@ -15,14 +15,14 @@
*/
package org.springframework.data.release.git;
import jakarta.annotation.PostConstruct;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
import javax.annotation.PostConstruct;
import org.eclipse.jgit.transport.CredentialsProvider;
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.data.release.model.Gpg;
import org.springframework.data.release.model.Password;

View File

@@ -17,6 +17,7 @@ package org.springframework.data.release.io;
import static org.springframework.data.release.utils.StreamUtils.*;
import jakarta.annotation.PostConstruct;
import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
@@ -38,10 +39,9 @@ import java.util.Scanner;
import java.util.function.Predicate;
import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.data.release.model.Project;
import org.springframework.data.release.model.Projects;
import org.springframework.data.release.model.SupportedProject;
import org.springframework.data.release.utils.Logger;

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.release.issues.github;
import jakarta.annotation.PostConstruct;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
@@ -22,8 +23,6 @@ import lombok.RequiredArgsConstructor;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.data.release.git.GitProperties;
import org.springframework.data.release.utils.HttpBasicCredentials;

View File

@@ -47,6 +47,10 @@ public class Password implements Masked {
return new Password(password);
}
public char[] toCharArray() {
return value.toCharArray();
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()

View File

@@ -17,18 +17,19 @@ package org.springframework.data.release.utils;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.hc.client5.http.auth.AuthCache;
import org.apache.hc.client5.http.auth.AuthScope;
import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
import org.apache.hc.client5.http.impl.auth.BasicAuthCache;
import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
import org.apache.hc.client5.http.impl.auth.BasicScheme;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.client5.http.protocol.HttpClientContext;
import org.apache.hc.core5.http.HttpHost;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.AuthCache;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.auth.BasicScheme;
import org.apache.http.impl.client.BasicAuthCache;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.data.util.Lazy;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpRequest;
@@ -41,8 +42,8 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
*/
public class HttpComponentsClientHttpRequestFactoryBuilder {
private final CredentialsProvider credsProvider = new BasicCredentialsProvider();
private final AuthCache authCache = new BasicAuthCache();
private final BasicCredentialsProvider credsProvider = new BasicCredentialsProvider();
private final BasicAuthCache authCache = new BasicAuthCache();
private HttpComponentsClientHttpRequestFactoryBuilder() {
@@ -93,15 +94,19 @@ public class HttpComponentsClientHttpRequestFactoryBuilder {
return factory;
}
private static void addPreemptiveAuth(CredentialsProvider credsProvider, AuthCache authCache, String requestUrl,
private static void addPreemptiveAuth(BasicCredentialsProvider credsProvider, AuthCache authCache, String requestUrl,
HttpBasicCredentials credentials) {
HttpHost host = HttpHost.create(requestUrl);
try {
HttpHost host = HttpHost.create(requestUrl);
credsProvider.setCredentials(new AuthScope(host),
new UsernamePasswordCredentials(credentials.getUsername(), credentials.getPassword().toString()));
credsProvider.setCredentials(new AuthScope(host),
new UsernamePasswordCredentials(credentials.getUsername(), credentials.getPassword().toCharArray()));
authCache.put(host, new BasicScheme());
authCache.put(host, new BasicScheme());
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
}