From eec3eed5f5da7f07d8b765a0a3d13fe35107ab6f Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 12 Feb 2018 14:32:46 +0100 Subject: [PATCH] Mention how to configure the web application type in tests Closes gh-11025 --- .../src/main/asciidoc/spring-boot-features.adoc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 4a30de2b4c..f9ecab7cf8 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -5990,6 +5990,23 @@ TIP: Do not forget to add `@RunWith(SpringRunner.class)` to your test. Otherwise annotations are ignored. +==== Detecting Web Application Type +If Spring MVC is available, a regular MVC-based application context is configured. If you +have only Spring WebFlux, we'll detect that and configure a WebFlux-based application +context instead. + +If both are present, Spring MVC takes precedence. If you want to test a reactive web +application in this scenario, you must set the `spring.main.web-application-type` +property: + +[source,java,indent=0] +---- + @RunWith(SpringRunner.class) + @SpringBootTest(properties = "spring.main.web-application-type=reactive") + public class MyWebFluxTests { ... } +---- + + [[boot-features-testing-spring-boot-applications-detecting-config]] ==== Detecting Test Configuration