Allow WebDriver beans to define their own scope

Update `WebDriverScope` so that only `WebDriver` beans with no explicit
scope are moved.

Fixes gh-7454
This commit is contained in:
Phillip Webb
2016-11-22 15:26:41 -08:00
parent 7e2d0fd1c0
commit 74670cb20f
3 changed files with 112 additions and 2 deletions

View File

@@ -5226,6 +5226,11 @@ and/or a `WebDriver` bean. Here is an example that uses HtmlUnit:
}
----
NOTE: By default Spring Boot will put `WebDriver` beans in a special "`scope`" to ensure
that the driver is quit after each test, and that a new instance is injected. If you don't
want this behavor you can add `@Scope("singleton")` to your `WebDriver` `@Bean`
definition.
A list of the auto-configuration that is enabled by `@WebMvcTest` can be
<<appendix-test-auto-configuration#test-auto-configuration,found in the appendix>>.