Does it make sense to support a way to wire up HTTP interface clients with @RestClientTest? Example:

@HttpServiceClient("hello")
public interface HelloClient {

    @GetExchange(value = "/hello", version = "2")
    String hello();
}
@RestClientTest(HelloClientTest.class)
class HelloClientTest {

    @Autowired
    private HelloClient helloClient;

    @Autowired
    MockRestServiceServer mockRestServiceServer;

    @Test
    void hello() {
        mockRestServiceServer.expect(requestToUriTemplate("http://localhost:8080/hello?version={version}", 2))
                .andRespond(withSuccess("Hello There!", MediaType.TEXT_PLAIN));
        assertThat(helloClient.hello()).isEqualTo("Hello There!");
    }
}

I was able to get this to work in this Sample Repository by adding HttpServiceClientAutoConfiguration to AutoConfigureWebClient. This doesn't work when you define more than one HTTP client interfaces. Maybe it could use the components defined on the annotation to pick which client to wire up? Or maybe a new @HttpServiceClientTest?

Comment From: bclozel

I'm not sure this is a good idea. As outlined in the Spring Framework reference documentation, MockRestServiceServer predates better alternatives like OkHttp and Wiremock. If anything, I think we should investigate whether we can fade out MockRestServiceServer usage and replace it with a better alternative.

Comment From: wilkinsona

We discussed this today and think that a new slice (perhaps @HttpServiceClientTest as suggested above) could be useful. We'd also want to target Wiremock or OkHttp's mock web server rather than MockRestServiceServer.