@Deprecated public class JavaConfigContextLoader extends Object implements org.springframework.test.context.ContextLoader
ContextLoader strategy for creating a
AnnotationConfigApplicationContext for a test's
@ContextConfiguration
Example usage:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"com.myco.TestDatabaseConfiguration", "com.myco.config"},
loader = JavaConfigContextLoader.class)
public MyTests { ... }
Implementation note: At this time, due to restrictions in Java annotations and Spring's
TestContext framework, locations of classes / packages must be specified as strings to
the ContextConfiguration annotation. It is understood that this has a detrimental effect
on type safety, discoverability and refactoring, and for these reasons may change in
future revisions, possibly with a customized version of the ContextConfiguration annotation
that accepts an array of class literals to load.ContextConfiguration| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger
Deprecated.
|
| Constructor and Description |
|---|
JavaConfigContextLoader()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
org.springframework.context.ApplicationContext |
loadContext(String... locations)
Deprecated.
Loads a new
context based on the supplied locations,
configures the context, and finally returns the context in fully refreshed state. |
String[] |
processLocations(Class<?> clazz,
String... locations)
Deprecated.
Simply returns the supplied locations unchanged.
|
public String[] processLocations(Class<?> clazz, String... locations)
processLocations in interface org.springframework.test.context.ContextLoaderclazz - the class with which the locations are associated: used to determine how to
process the supplied locations.locations - the unmodified locations to use for loading the application context; can be
null or empty.ContextLoader.processLocations(Class, String[])public org.springframework.context.ApplicationContext loadContext(String... locations)
context based on the supplied locations,
configures the context, and finally returns the context in fully refreshed state.
Configuration locations are either fully-qualified class names or base package names. These
locations will be given to a AnnotationConfigApplicationContext for configuration via the
AnnotationConfigApplicationContext.register(Class[]) and
AnnotationConfigApplicationContext.scan(String...) methods.loadContext in interface org.springframework.test.context.ContextLoaderlocations - the locations to use to load the application contextIllegalArgumentException - if any of locations are not valid fully-qualified
Class or Package namesApache Camel