|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ContextLoader
Strategy interface for loading an
application context
.
Clients of a ContextLoader should call
processLocations()
prior to
calling loadContext()
in case the
ContextLoader provides custom support for modifying or generating locations.
The results of processLocations()
should then be supplied to loadContext()
.
Concrete implementations must provide a public
no-args
constructor.
Spring provides the following out-of-the-box implementations:
Method Summary | |
---|---|
ApplicationContext |
loadContext(String... locations)
Loads a new context based on the supplied
locations , configures the context, and finally returns
the context, potentially refreshed. |
String[] |
processLocations(Class<?> clazz,
String... locations)
Processes application context resource locations for a specified class. |
Method Detail |
---|
String[] processLocations(Class<?> clazz, String... locations)
Processes application context resource locations for a specified class.
Concrete implementations may choose to modify the supplied locations, generate new locations, or simply return the supplied locations unchanged.
clazz
- 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.
ApplicationContext loadContext(String... locations) throws Exception
Loads a new context
based on the supplied
locations
, configures the context, and finally returns
the context, potentially refreshed.
Configuration locations are generally considered to be classpath resources by default.
Concrete implementations should register annotation configuration
processors with bean factories of
application contexts
loaded by this
ContextLoader. Beans will therefore automatically be candidates for
annotation-based dependency injection using
@Autowired
and @Resource
.
Any ApplicationContext loaded by a ContextLoader must register a JVM shutdown hook for itself. Unless the context gets closed early, all context instances will be automatically closed on JVM shutdown. This allows for freeing external resources held by beans within the context, e.g. temporary files.
locations
- The resource locations to use to load the application
context.
Exception
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |