title: spring boot: how to configure autowired WebTestClient
body: <p>Are there any properties available in Spring Boot to configure the @Autowired WebTestClient? For instance, how to set the servlet context path (or just some base path for that matter) on WebTestClient?</p>
  
  <p>Here's how my web tests are configured now:</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
  @ActiveProfiles("test")
  public class MyTestClass{
  
    @Autowired
    private WebTestClient cl;
  
    //the rest of it
  }
  </code></pre>
  
  <p>In other words, what is Spring Boot equivalent of </p>
  
  <pre><code>WebTestClient client = WebTestClient.bindToServer()
      .baseUrl("http://localhost:&lt;random port&gt;/myServletContext").build();
  </code></pre>
  
  <p>I didn't find anything useful in documentation:
  <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html" rel="noreferrer">https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html</a></p>