Mention how to configure the web application type in tests
Closes gh-11025
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user