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
@ -202,15 +201,6 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
@@ -202,15 +201,6 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
@ -272,13 +272,8 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@@ -272,13 +272,8 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@ -297,7 +292,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@@ -297,7 +292,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@ -307,10 +302,29 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@@ -307,10 +302,29 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@ -324,6 +338,9 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@@ -324,6 +338,9 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@ -335,11 +352,15 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@@ -335,11 +352,15 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@ -349,34 +370,53 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@@ -349,34 +370,53 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@ -389,7 +429,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@@ -389,7 +429,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@ -400,7 +440,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@@ -400,7 +440,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@ -429,7 +469,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@@ -429,7 +469,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@ -439,7 +479,8 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@@ -439,7 +479,8 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
@ -109,6 +109,10 @@ public class BootstrapTestUtilsContextInitializerTests extends AbstractContextCo
@@ -109,6 +109,10 @@ public class BootstrapTestUtilsContextInitializerTests extends AbstractContextCo
@ -200,4 +221,8 @@ public class BootstrapTestUtilsMergedConfigTests extends AbstractContextConfigur
@@ -200,4 +221,8 @@ public class BootstrapTestUtilsMergedConfigTests extends AbstractContextConfigur
@ -686,6 +686,8 @@ Spring 4.3 also improves the caching abstraction as follows:
@@ -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.