Files

92 lines
3.9 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.1.1</version>
<relativePath/>
</parent>
<groupId>com.ankurm</groupId>
<artifactId>rest-test-client</artifactId>
<version>1.0.0</version>
<name>rest-test-client</name>
<description>RestTestClient in Spring Framework 7: one client across bindToController, bindToMockMvc,
bindToApplicationContext and bindToServer, vs MockMvcTester, vs the relocated TestRestTemplate</description>
<packaging>jar</packaging>
<properties>
<java.version>25</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
<!-- The app itself never calls RestTemplate. This is here only because
TestRestTemplateTestAutoConfiguration needs RestTemplateBuilder on the classpath to build
its bean: without it, @AutoConfigureTestRestTemplate fails the whole context with a
NoClassDefFoundError on org.springframework.boot.restclient.RestTemplateBuilder, not a
clean "bean not found." Confirmed by hitting that exact failure with this dependency left
out, then adding it back. -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-restclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- RestTestClient itself (org.springframework.test.web.servlet.client.RestTestClient) ships
inside Spring Framework's spring-test jar, already on the classpath via
spring-boot-starter-test above. What is NOT on that classpath: TestRestTemplate, and the
two test-slice annotations that wire either client into a @SpringBootTest context:
@AutoConfigureRestTestClient and @AutoConfigureTestRestTemplate. In Spring Boot 4 both of
those, plus TestRestTemplate itself, moved out of spring-boot-test into their own module,
confirmed by unzipping this jar: it is spring-boot-resttestclient, not the similarly
spelled spring-boot-restclient-test (that one backs the unrelated @RestClientTest slice
for testing outbound RestClient/RestTemplate callers). See the post. -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-resttestclient</artifactId>
<scope>test</scope>
</dependency>
<!-- @WebMvcTest itself moved too: it is no longer in spring-boot-test-autoconfigure.
Boot 4 split every web-stack-specific test slice into its own module alongside the
matching main module (spring-boot-webmvc / spring-boot-webmvc-test, spring-boot-webflux
/ spring-boot-webflux-test, and so on): confirmed the same way, by unzipping the
jar and finding WebMvcTest.class under org/springframework/boot/webmvc/test/autoconfigure. -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>rest-test-client</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>