Remove most deprecated APIs that were due for removal in 4.0

Support for rest controller, controler, and servlet endpoints has
been kept for now.

Issue: 45600
This commit is contained in:
Andy Wilkinson
2025-06-10 20:11:08 +01:00
committed by Phillip Webb
parent bf385649ec
commit a78797a2ba
192 changed files with 94 additions and 10953 deletions

View File

@@ -26,7 +26,6 @@ import org.springframework.boot.buildpack.platform.docker.TotalProgressEvent;
import org.springframework.boot.buildpack.platform.docker.TotalProgressPullListener;
import org.springframework.boot.buildpack.platform.docker.TotalProgressPushListener;
import org.springframework.boot.buildpack.platform.docker.UpdateListener;
import org.springframework.boot.buildpack.platform.docker.configuration.DockerConnectionConfiguration;
import org.springframework.boot.buildpack.platform.docker.configuration.DockerRegistryAuthentication;
import org.springframework.boot.buildpack.platform.docker.configuration.ResolvedDockerHost;
import org.springframework.boot.buildpack.platform.docker.transport.DockerEngineException;
@@ -64,20 +63,6 @@ public class Builder {
this(BuildLog.toSystemOut());
}
/**
* Create a new builder instance.
* @param dockerConfiguration the docker configuration
* @since 2.4.0
* @deprecated since 3.5.0 for removal in 4.0.0 in favor of
* {@link #Builder(BuilderDockerConfiguration)}
*/
@Deprecated(since = "3.5.0", forRemoval = true)
@SuppressWarnings("removal")
public Builder(
org.springframework.boot.buildpack.platform.docker.configuration.DockerConfiguration dockerConfiguration) {
this(BuildLog.toSystemOut(), dockerConfiguration);
}
/**
* Create a new builder instance.
* @param dockerConfiguration the docker configuration
@@ -95,33 +80,6 @@ public class Builder {
this(log, new DockerApi(null, BuildLogAdapter.get(log)), null);
}
/**
* Create a new builder instance.
* @param log a logger used to record output
* @param dockerConfiguration the docker configuration
* @since 2.4.0
* @deprecated since 3.5.0 for removal in 4.0.0 in favor of
* {@link #Builder(BuildLog, BuilderDockerConfiguration)}
*/
@Deprecated(since = "3.5.0", forRemoval = true)
@SuppressWarnings("removal")
public Builder(BuildLog log,
org.springframework.boot.buildpack.platform.docker.configuration.DockerConfiguration dockerConfiguration) {
this(log, adaptDeprecatedConfiguration(dockerConfiguration));
}
@SuppressWarnings("removal")
private static BuilderDockerConfiguration adaptDeprecatedConfiguration(
org.springframework.boot.buildpack.platform.docker.configuration.DockerConfiguration configuration) {
if (configuration == null) {
return null;
}
DockerConnectionConfiguration connection = org.springframework.boot.buildpack.platform.docker.configuration.DockerConfiguration.DockerHostConfiguration
.asConnectionConfiguration(configuration.getHost());
return new BuilderDockerConfiguration(connection, configuration.isBindHostToBuilder(),
configuration.getBuilderRegistryAuthentication(), configuration.getPublishRegistryAuthentication());
}
/**
* Create a new builder instance.
* @param log a logger used to record output

View File

@@ -90,21 +90,6 @@ public class DockerApi {
this(HttpTransport.create((DockerConnectionConfiguration) null), DockerLog.toSystemOut());
}
/**
* Create a new {@link DockerApi} instance.
* @param dockerHost the Docker daemon host information
* @since 2.4.0
* @deprecated since 3.5.0 for removal in 4.0.0 in favor of
* {@link #DockerApi(DockerConnectionConfiguration, DockerLog)}
*/
@Deprecated(since = "3.5.0", forRemoval = true)
@SuppressWarnings("removal")
public DockerApi(
org.springframework.boot.buildpack.platform.docker.configuration.DockerConfiguration.DockerHostConfiguration dockerHost) {
this(org.springframework.boot.buildpack.platform.docker.configuration.DockerConfiguration.DockerHostConfiguration
.asConnectionConfiguration(dockerHost), DockerLog.toSystemOut());
}
/**
* Create a new {@link DockerApi} instance.
* @param connectionConfiguration the connection configuration to use

View File

@@ -1,193 +0,0 @@
/*
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.buildpack.platform.docker.configuration;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
* Docker configuration options.
*
* @author Wei Jiang
* @author Scott Frederick
* @since 2.4.0
* @deprecated since 3.5.0 for removal in 4.0.0 in favor of
* {@link org.springframework.boot.buildpack.platform.build.BuilderDockerConfiguration}.
*/
@Deprecated(since = "3.5.0", forRemoval = true)
@SuppressWarnings("removal")
public final class DockerConfiguration {
private final DockerHostConfiguration host;
private final DockerRegistryAuthentication builderAuthentication;
private final DockerRegistryAuthentication publishAuthentication;
private final boolean bindHostToBuilder;
public DockerConfiguration() {
this(null, null, null, false);
}
private DockerConfiguration(DockerHostConfiguration host, DockerRegistryAuthentication builderAuthentication,
DockerRegistryAuthentication publishAuthentication, boolean bindHostToBuilder) {
this.host = host;
this.builderAuthentication = builderAuthentication;
this.publishAuthentication = publishAuthentication;
this.bindHostToBuilder = bindHostToBuilder;
}
public DockerHostConfiguration getHost() {
return this.host;
}
public boolean isBindHostToBuilder() {
return this.bindHostToBuilder;
}
public DockerRegistryAuthentication getBuilderRegistryAuthentication() {
return this.builderAuthentication;
}
public DockerRegistryAuthentication getPublishRegistryAuthentication() {
return this.publishAuthentication;
}
public DockerConfiguration withHost(String address, boolean secure, String certificatePath) {
Assert.notNull(address, "'address' must not be null");
return new DockerConfiguration(DockerHostConfiguration.forAddress(address, secure, certificatePath),
this.builderAuthentication, this.publishAuthentication, this.bindHostToBuilder);
}
public DockerConfiguration withContext(String context) {
Assert.notNull(context, "'context' must not be null");
return new DockerConfiguration(DockerHostConfiguration.forContext(context), this.builderAuthentication,
this.publishAuthentication, this.bindHostToBuilder);
}
public DockerConfiguration withBindHostToBuilder(boolean bindHostToBuilder) {
return new DockerConfiguration(this.host, this.builderAuthentication, this.publishAuthentication,
bindHostToBuilder);
}
public DockerConfiguration withBuilderRegistryTokenAuthentication(String token) {
Assert.notNull(token, "'token' must not be null");
return new DockerConfiguration(this.host, new DockerRegistryTokenAuthentication(token),
this.publishAuthentication, this.bindHostToBuilder);
}
public DockerConfiguration withBuilderRegistryUserAuthentication(String username, String password, String url,
String email) {
Assert.notNull(username, "'username' must not be null");
Assert.notNull(password, "'password' must not be null");
return new DockerConfiguration(this.host, new DockerRegistryUserAuthentication(username, password, url, email),
this.publishAuthentication, this.bindHostToBuilder);
}
public DockerConfiguration withPublishRegistryTokenAuthentication(String token) {
Assert.notNull(token, "'token' must not be null");
return new DockerConfiguration(this.host, this.builderAuthentication,
new DockerRegistryTokenAuthentication(token), this.bindHostToBuilder);
}
public DockerConfiguration withPublishRegistryUserAuthentication(String username, String password, String url,
String email) {
Assert.notNull(username, "'username' must not be null");
Assert.notNull(password, "'password' must not be null");
return new DockerConfiguration(this.host, this.builderAuthentication,
new DockerRegistryUserAuthentication(username, password, url, email), this.bindHostToBuilder);
}
public DockerConfiguration withEmptyPublishRegistryAuthentication() {
return new DockerConfiguration(this.host, this.builderAuthentication,
new DockerRegistryUserAuthentication("", "", "", ""), this.bindHostToBuilder);
}
/**
* Docker host configuration.
*
* @deprecated since 3.5.0 for removal in 4.0.0 in favor of
* {@link DockerHostConfiguration}
*/
@Deprecated(since = "3.5.0", forRemoval = true)
public static class DockerHostConfiguration {
private final String address;
private final String context;
private final boolean secure;
private final String certificatePath;
public DockerHostConfiguration(String address, String context, boolean secure, String certificatePath) {
this.address = address;
this.context = context;
this.secure = secure;
this.certificatePath = certificatePath;
}
public String getAddress() {
return this.address;
}
public String getContext() {
return this.context;
}
public boolean isSecure() {
return this.secure;
}
public String getCertificatePath() {
return this.certificatePath;
}
public static DockerHostConfiguration forAddress(String address) {
return new DockerHostConfiguration(address, null, false, null);
}
public static DockerHostConfiguration forAddress(String address, boolean secure, String certificatePath) {
return new DockerHostConfiguration(address, null, secure, certificatePath);
}
static DockerHostConfiguration forContext(String context) {
return new DockerHostConfiguration(null, context, false, null);
}
/**
* Adapts a {@link DockerHostConfiguration} to a
* {@link DockerConnectionConfiguration}.
* @param configuration the configuration to adapt
* @return the adapted configuration
* @since 3.5.0
*/
public static DockerConnectionConfiguration asConnectionConfiguration(DockerHostConfiguration configuration) {
if (configuration != null && StringUtils.hasLength(configuration.context)) {
return new DockerConnectionConfiguration.Context(configuration.context);
}
if (configuration != null && StringUtils.hasLength(configuration.address)) {
return new DockerConnectionConfiguration.Host(configuration.address, configuration.secure,
configuration.certificatePath);
}
return null;
}
}
}

View File

@@ -76,20 +76,6 @@ public class ResolvedDockerHost extends DockerHost {
}
}
/**
* Create a new {@link ResolvedDockerHost} from the given host configuration.
* @param dockerHostConfiguration the host configuration or {@code null}
* @return the resolved docker host
* @deprecated since 3.5.0 for removal in 4.0.0 in favor of
* {@link #from(DockerConnectionConfiguration)}
*/
@Deprecated(since = "3.5.0", forRemoval = true)
@SuppressWarnings("removal")
public static ResolvedDockerHost from(DockerConfiguration.DockerHostConfiguration dockerHostConfiguration) {
return from(Environment.SYSTEM,
DockerConfiguration.DockerHostConfiguration.asConnectionConfiguration(dockerHostConfiguration));
}
/**
* Create a new {@link ResolvedDockerHost} from the given host configuration.
* @param connectionConfiguration the host configuration or {@code null}

View File

@@ -99,22 +99,6 @@ public interface HttpTransport {
*/
Response head(URI uri) throws IOException;
/**
* Create the most suitable {@link HttpTransport} based on the {@link DockerHost}.
* @param dockerHost the Docker host information
* @return a {@link HttpTransport} instance
* @deprecated since 3.5.0 for removal in 4.0.0 in favor of
* {@link #create(DockerConnectionConfiguration)}
*/
@Deprecated(since = "3.5.0", forRemoval = true)
@SuppressWarnings("removal")
static HttpTransport create(
org.springframework.boot.buildpack.platform.docker.configuration.DockerConfiguration.DockerHostConfiguration dockerHost) {
ResolvedDockerHost host = ResolvedDockerHost.from(dockerHost);
HttpTransport remote = RemoteHttpClientTransport.createIfPossible(host);
return (remote != null) ? remote : LocalHttpClientTransport.create(host);
}
/**
* Create the most suitable {@link HttpTransport} based on the {@link DockerHost}.
* @param connectionConfiguration the Docker host information

View File

@@ -1,62 +0,0 @@
/*
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.buildpack.platform.docker.configuration;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link DockerConfiguration}.
*
* @author Wei Jiang
* @author Scott Frederick
*/
@SuppressWarnings("removal")
class DockerConfigurationTests {
@Test
void createDockerConfigurationWithDefaults() {
DockerConfiguration configuration = new DockerConfiguration();
assertThat(configuration.getBuilderRegistryAuthentication()).isNull();
}
@Test
void createDockerConfigurationWithUserAuth() {
DockerConfiguration configuration = new DockerConfiguration().withBuilderRegistryUserAuthentication("user",
"secret", "https://docker.example.com", "docker@example.com");
DockerRegistryAuthentication auth = configuration.getBuilderRegistryAuthentication();
assertThat(auth).isNotNull();
assertThat(auth).isInstanceOf(DockerRegistryUserAuthentication.class);
DockerRegistryUserAuthentication userAuth = (DockerRegistryUserAuthentication) auth;
assertThat(userAuth.getUrl()).isEqualTo("https://docker.example.com");
assertThat(userAuth.getUsername()).isEqualTo("user");
assertThat(userAuth.getPassword()).isEqualTo("secret");
assertThat(userAuth.getEmail()).isEqualTo("docker@example.com");
}
@Test
void createDockerConfigurationWithTokenAuth() {
DockerConfiguration configuration = new DockerConfiguration().withBuilderRegistryTokenAuthentication("token");
DockerRegistryAuthentication auth = configuration.getBuilderRegistryAuthentication();
assertThat(auth).isNotNull();
assertThat(auth).isInstanceOf(DockerRegistryTokenAuthentication.class);
DockerRegistryTokenAuthentication tokenAuth = (DockerRegistryTokenAuthentication) auth;
assertThat(tokenAuth.getToken()).isEqualTo("token");
}
}