Skip to content

Commit 3bf53f8

Browse files
wilkinsonaphilwebb
authored andcommitted
Introduce @AutoConfigureTestRestTemplate
Add `@AutoConfigureTestRestTemplate` which can be used to auto-configure a `TestRestTemplate`. See gh-46356
1 parent 062bda3 commit 3bf53f8

File tree

64 files changed

+207
-601
lines changed

Some content is hidden

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

64 files changed

+207
-601
lines changed

documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.springframework.beans.factory.annotation.Autowired;
2424
import org.springframework.boot.restclient.RestTemplateBuilder;
2525
import org.springframework.boot.restclient.test.TestRestTemplate;
26+
import org.springframework.boot.restclient.test.autoconfigure.AutoConfigureTestRestTemplate;
2627
import org.springframework.boot.test.context.SpringBootTest;
2728
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
2829
import org.springframework.boot.test.context.TestConfiguration;
@@ -32,6 +33,7 @@
3233
import static org.assertj.core.api.Assertions.assertThat;
3334

3435
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
36+
@AutoConfigureTestRestTemplate
3537
class MySpringBootTests {
3638

3739
@Autowired

documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment
2424
import org.springframework.boot.test.context.TestConfiguration
2525
import org.springframework.boot.restclient.RestTemplateBuilder
2626
import org.springframework.boot.restclient.test.TestRestTemplate
27+
import org.springframework.boot.restclient.test.autoconfigure.AutoConfigureTestRestTemplate
2728
import org.springframework.context.annotation.Bean
2829
import java.time.Duration
2930

3031
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
32+
@AutoConfigureTestRestTemplate
3133
class MySpringBootTests(@Autowired val template: TestRestTemplate) {
3234

3335
@Test

integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/NoTestRestTemplateBeanChecker.java

Lines changed: 0 additions & 46 deletions
This file was deleted.

integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerIntegrationTests.java

Lines changed: 0 additions & 78 deletions
This file was deleted.

integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerTests.java

Lines changed: 0 additions & 91 deletions
This file was deleted.

integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerWithFactoryBeanTests.java

Lines changed: 0 additions & 62 deletions
This file was deleted.

integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerWithOverrideIntegrationTests.java

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)