Polish "Deprecate TestRestTemplate"

See gh-46632
This commit is contained in:
Stéphane Nicoll
2026-07-27 21:12:35 +02:00
parent 9142b18312
commit 297ee86945
23 changed files with 18 additions and 453 deletions
-1
View File
@@ -52,7 +52,6 @@ dependencies {
testImplementation(project(":core:spring-boot-test"))
testImplementation(project(":module:spring-boot-restclient"))
testImplementation(project(":module:spring-boot-resttestclient"))
testImplementation(project(":module:spring-boot-tomcat"))
testImplementation(project(":test-support:spring-boot-test-support"))
testImplementation(testFixtures(project(":module:spring-boot-actuator-autoconfigure")))
@@ -24,13 +24,12 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.restclient.RestTemplateBuilder;
import org.springframework.boot.test.autoconfigure.json.AutoConfigureJson;
import org.springframework.web.client.RestClient.Builder;
/**
* Annotation that can be applied to a test class to enable auto-configuration of a
* {@link Builder RestClient.Builder} and a {@link RestTemplateBuilder}.
* {@link Builder RestClient.Builder}.
*
* @author Andy Wilkinson
* @since 4.0.0
@@ -90,10 +90,10 @@ import org.springframework.web.util.UriTemplateHandler;
* @author Dmytro Nosan
* @author Yanming Zhou
* @since 4.0.0
* @deprecated since 4.1.0 for removal in 4.3.0 in favor of
* @deprecated since 4.2.0 for removal in 4.4.0 in favor of
* {@link org.springframework.test.web.servlet.client.RestTestClient}
*/
@Deprecated(since = "4.1.0", forRemoval = true)
@Deprecated(since = "4.2.0", forRemoval = true)
@SuppressWarnings("removal")
public class TestRestTemplate {
@@ -32,12 +32,15 @@ import org.springframework.boot.resttestclient.TestRestTemplate;
*
* @author Andy Wilkinson
* @since 4.0.0
* @deprecated since 4.2.0 for removal in 4.4.0 in favor of
* {@link AutoConfigureRestTestClient}
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@ImportAutoConfiguration
@Deprecated(since = "4.2.0", forRemoval = true)
public @interface AutoConfigureTestRestTemplate {
}
@@ -31,8 +31,11 @@ import org.springframework.context.annotation.Bean;
*
* @author Andy Wilkinson
* @see AutoConfigureTestRestTemplate
* @deprecated since 4.2.0 for removal in 4.4.0 in favor of
* {@link RestTestClientTestAutoConfiguration}
*/
@AutoConfiguration
@Deprecated(since = "4.2.0", forRemoval = true)
@SuppressWarnings("removal")
final class TestRestTemplateTestAutoConfiguration {
@@ -34,7 +34,10 @@ import java.net.URI
*
* @author Sebastien Deleuze
* @since 4.0.0
* @deprecated since 4.2.0 for removal in 4.4.0 in favor of
* {@link org.springframework.test.web.servlet.client.RestTestClient}
*/
@Deprecated(message = "in favor of RestTestClient", level = DeprecationLevel.ERROR)
@Throws(RestClientException::class)
inline fun <reified T : Any> TestRestTemplate.getForObject(url: String, vararg uriVariables: Any): T? =
getForObject(url, T::class.java, *uriVariables)
@@ -79,7 +79,9 @@ import static org.mockito.Mockito.mock;
* @author Andy Wilkinson
* @author Kristine Jetzke
* @author Yanming Zhou
* @deprecated since 4.2.0 for removal in 4.4.0
*/
@Deprecated(since = "4.2.0", forRemoval = true)
@SuppressWarnings("removal")
class TestRestTemplateTests {
@@ -34,7 +34,9 @@ import static org.assertj.core.api.Assertions.assertThat;
* Tests for {@link TestRestTemplateTestAutoConfiguration}.
*
* @author Stephane Nicoll
* @deprecated since 4.2.0 for removal in 4.4.0
*/
@Deprecated(since = "4.2.0", forRemoval = true)
@SuppressWarnings("removal")
class TestRestTemplateTestAutoConfigurationTests {