|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value=TYPE) @Inherited @Documented 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 . |
public abstract String[] locations
ApplicationContext
.
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".
If@ContextConfiguration
(locations={"base-context.xml"}) public class BaseTest { // ... }@ContextConfiguration
(locations={"extended-context.xml"}) public class ExtendedTest extends BaseTest { // ... }
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
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |