• Java 21
  • Spring Boot 4 RC1
  • Example projects:
    • https://github.com/hantsy/spring7-sandbox/blob/master/boot-api-versioning-webflux
    • https://github.com/hantsy/spring7-sandbox/blob/master/boot-api-versioning-webmvc

In the webflux example, webflux-test will autoconfigure WebTestClient, but in the webmvc example, webmvc-test module does not autoconfigure RestTestClient.

Comment From: wilkinsona

Thanks for trying the RC. This is intentional. MockMvc is the primary means of testing an app using WebMvcTest and WebTestClient is the primary means of testing an app using WebFluxTest. If you want an additional client, you should use the corresponding @AutoConfigure… annotation such as @AutoConfigureRestTestClient. We mention this in the section on testing against a running server and in the section on testing with a mock environment. It's probably worth mentioning in the [section on auto-configured Spring MVC tests] as well. We can use this issue to do that and to review the section on auto-configured Spring WebFlux tests to see if it would benefit from a similar change.

Comment From: hantsy

MockMvc is the primary means of testing an app using WebMvcTest and WebTestClient is the primary means of testing an app using WebFluxTest.

Similar to RestClient(replacing the RestTemplate) becoming a first-class citizen in the new Spring Boot version, I also hope RestTestClient follows the change.

And I can not find API versioning operations in MockMvc like RestTestClient/WebTestClient, see https://github.com/spring-projects/spring-framework/issues/35756

Comment From: wilkinsona

Similar to RestClient(replacing the RestTemplate) becoming a first-class citizen in the new Spring Boot version, I also hope RestTestClient follows the change.

RestTestClient is already a first-class citizen and we have opt-in auto-configuration for it in Boot 4.0. FWIW, TestRestTemplate is now opt-in as well. https://github.com/spring-projects/spring-boot/issues/46632 is tracking deprecating TestRestTemplate in favor of RestTestClient.