@TestExecutionListeners(value={ServletTestExecutionListener.class,DirtiesContextBeforeModesTestExecutionListener.class,DependencyInjectionTestExecutionListener.class,DirtiesContextTestExecutionListener.class}) public abstract class AbstractJUnit4SpringContextTests extends Object implements ApplicationContextAware
ApplicationContext testing support
 in a JUnit environment.
 Concrete subclasses should typically declare a class-level
 @ContextConfiguration annotation to
 configure the application context resource locations or annotated classes. If your test does not
 need to load an application context, you may choose to omit the
 @ContextConfiguration declaration and to configure
 the appropriate TestExecutionListeners manually.
 
The following TestExecutionListeners are configured by default:
 
ServletTestExecutionListener
 DirtiesContextBeforeModesTestExecutionListener
 DependencyInjectionTestExecutionListener
 DirtiesContextTestExecutionListener
 This class serves only as a convenience for extension.
SpringRunner, @ContextConfiguration,
 @TestExecutionListeners, etc.SpringRunner, as of Spring Framework 4.2 you can use
 SpringClassRule and
 SpringMethodRule
 and specify your runner of choice via @RunWith(...).NOTE: As of Spring Framework 4.3, this class requires JUnit 4.12 or higher.
ContextConfiguration, 
TestContext, 
TestContextManager, 
TestExecutionListeners, 
ServletTestExecutionListener, 
DirtiesContextBeforeModesTestExecutionListener, 
DependencyInjectionTestExecutionListener, 
DirtiesContextTestExecutionListener, 
AbstractTransactionalJUnit4SpringContextTests, 
AbstractTestNGSpringContextTests| Modifier and Type | Field and Description | 
|---|---|
| protected ApplicationContext | applicationContextThe  ApplicationContextthat was injected into this test instance
 viasetApplicationContext(ApplicationContext). | 
| protected Log | loggerLogger available to subclasses. | 
| Constructor and Description | 
|---|
| AbstractJUnit4SpringContextTests() | 
| Modifier and Type | Method and Description | 
|---|---|
| void | setApplicationContext(ApplicationContext applicationContext)Set the  ApplicationContextto be used by this test instance,
 provided viaApplicationContextAwaresemantics. | 
protected final Log logger
@Nullable protected ApplicationContext applicationContext
ApplicationContext that was injected into this test instance
 via setApplicationContext(ApplicationContext).public final void setApplicationContext(ApplicationContext applicationContext)
ApplicationContext to be used by this test instance,
 provided via ApplicationContextAware semantics.setApplicationContext in interface ApplicationContextAwareapplicationContext - the ApplicationContext that this test runs inBeanInitializationException