Allow @ContextConfiguration to be omitted
Prior to this commit, the @ContextConfiguration annotation was required
to be present even if default XML files, Groovy scripts, or
@Configuration classes were detected; however, in such cases the
@ContextConfiguration was typically declared empty and therefore
seemingly unnecessary boilerplate.
This commit permits @ContextConfiguration to be omitted whenever it can
be reasonably deduced. Consequently, integration tests such as the
following are now supported.
@RunWith(SpringRunner.class)
public class MyTest {
@Autowired String myBean;
@Test public void example() { /* ... */ }
@Configuration
static class Config {
@Bean String myBean() {
return "Hello";
}
}
}
Issue: SPR-13955
This commit is contained in:
committed by
Sam Brannen
parent
0a56667093
commit
2244461778
@@ -686,6 +686,8 @@ Spring 4.3 also improves the caching abstraction as follows:
|
||||
|
||||
* The JUnit support in the _Spring TestContext Framework_ now requires JUnit 4.12 or higher.
|
||||
* New `SpringRunner` __alias__ for the `SpringJUnit4ClassRunner`.
|
||||
* An empty declaration of `@ContextConfiguration` can now be completely omitted if default
|
||||
XML files, Groovy scripts, or `@Configuration` classes are detected.
|
||||
* `@BeforeTransaction` and `@AfterTransaction` methods are no longer required to be `public`.
|
||||
* Server-side Spring MVC Test supports expectations on response headers with multiple values.
|
||||
* Server-side Spring MVC Test parses form data request content and populates request parameters.
|
||||
|
||||
Reference in New Issue
Block a user