|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||
@Documented @Inherited @Retention(value=RUNTIME) @Target(value=TYPE) public @interface ContextConfiguration
ContextConfiguration defines class-level metadata which can be used to
instruct client code with regard to how to load and configure an
ApplicationContext.
ContextLoader,
ApplicationContext| Optional Element Summary | |
|---|---|
boolean |
inheritLocations
Whether or not resource locations from superclasses
should be inherited. |
Class<? extends ContextLoader> |
loader
The type of ContextLoader to use for loading an
ApplicationContext. |
String[] |
locations
The resource locations to use for loading an ApplicationContext. |
String[] |
value
Alias for locations. |
public abstract String[] locations
ApplicationContext.
public abstract String[] value
locations.
public abstract boolean inheritLocations
resource locations from superclasses
should be inherited.
The default value is true, which means that an annotated
class will inherit the resource locations defined by an
annotated superclass. Specifically, the resource locations for an
annotated class will be appended to the list of resource locations
defined by an annotated superclass. Thus, subclasses have the option of
extending the list of resource locations. In the following
example, the ApplicationContext
for ExtendedTest will be loaded from
"base-context.xml" and
"extended-context.xml", in that order. Beans defined in
"extended-context.xml" may therefore override those defined in
"base-context.xml".
@ContextConfiguration("base-context.xml")
public class BaseTest {
// ...
}
@ContextConfiguration("extended-context.xml")
public class ExtendedTest extends BaseTest {
// ...
}
If inheritLocations is set to false, the
resource locations for the annotated class will shadow and
effectively replace any resource locations defined by a superclass.
public abstract Class<? extends ContextLoader> loader
ContextLoader to use for loading an
ApplicationContext.
If not specified, the loader will be inherited from the first superclass
which is annotated with @ContextConfiguration and specifies
an explicit loader. If no class in the hierarchy specifies an explicit
loader, a default loader will be used instead.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||