Refine inner-class test @Configuration detection

Update detection logic to also consider `@Rules` classes. Also make the
documentation a little clearer.

Fixes gh-6768
This commit is contained in:
Phillip Webb
2016-09-15 16:55:49 -07:00
parent 46815fc483
commit 5f7897ba41
4 changed files with 63 additions and 5 deletions

View File

@@ -4918,8 +4918,8 @@ annotations that can be used on classes in `src/test/java` to indicate that they
not be picked up by scanning.
NOTE: `@TestComponent` and `@TestConfiguration` are only needed on top level classes. If
you define `@Configuration` or `@Component` as inner-classes within a test, they will be
automatically filtered.
you define `@Configuration` or `@Component` as inner-classes within a test (any class
that has `@Test` methods or `@RunWith`), they will be automatically filtered.
NOTE: If you directly use `@ComponentScan` (i.e. not via `@SpringBootApplication`) you
will need to register the `TypeExcludeFilter` with it. See