Cant autowire `WebTestClient` - no auto configuration

The accepted answer keeps throwing that error for me, instead I had to add the webflux starter in addition to the test starter in Spring Boot 2.0.3:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-webflux</artifactId>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

Then use the standard web test annotations:

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class IntegrationTest {

    @Autowired
    private WebTestClient webClient;

    @Test
    public void test() {
        this.webClient.get().uri("/ui/hello.xhtml")
          .exchange().expectStatus().isOk();
    }

}

Annotate your MyControllerTest test class with @AutoConfigureWebTestClient annotation. That should solve the issue.