Note
Plain paths will always be interpreted as relative to the current VM working directory, even if they start with a slash. (This is consistent with the semantics in a Servlet container.) Use an explicit "file:" prefix to enforce an absolute file path.
The config location defaults can be overridden via getConfigLocations,
Config locations can either denote concrete files like "/myfiles/context.xml"
or Ant-style patterns like "/myfiles/*-context.xml" (see the
org. javadoc for pattern details).
Note
In case of multiple config locations, later bean definitions will override ones defined in earlier loaded files. This can be leveraged to deliberately override certain bean definitions via an extra XML file.
This is a simple, one-stop shop convenience ApplicationContext.
Consider using the GenericApplicationContext class in combination
with an org.
for more flexible context setup.
getResource, getResourceByPath, GenericApplicationContext
| Access | Constructor and Description |
|---|---|
| public | FileSystemXmlApplicationContext()
Create a new FileSystemXmlApplicationContext for bean-style configuration. |
| public | FileSystemXmlApplicationContext(ApplicationContext
the parent context parent)Create a new FileSystemXmlApplicationContext for bean-style configuration. |
| public | FileSystemXmlApplicationContext(String
file path configLocation)Create a new FileSystemXmlApplicationContext, loading the definitions from the given XML file and automatically refreshing the context. |
| public | FileSystemXmlApplicationContext(String...
array of file paths configLocations)Create a new FileSystemXmlApplicationContext, loading the definitions from the given XML files and automatically refreshing the context. |
| public | FileSystemXmlApplicationContext(String[]
array of file paths configLocations, ApplicationContext the parent context parent)Create a new FileSystemXmlApplicationContext with the given parent, loading the definitions from the given XML files and automatically refreshing the context. |
| public | FileSystemXmlApplicationContext(String[]
array of file paths configLocations, boolean whether to automatically refresh the context,
loading all bean definitions and creating all singletons.
Alternatively, call refresh manually after further configuring the context. refresh)Create a new FileSystemXmlApplicationContext, loading the definitions from the given XML files. |
| public | FileSystemXmlApplicationContext(String[]
array of file paths configLocations, boolean whether to automatically refresh the context,
loading all bean definitions and creating all singletons.
Alternatively, call refresh manually after further configuring the context. refresh, ApplicationContext the parent context parent)Create a new FileSystemXmlApplicationContext with the given parent, loading the definitions from the given XML files. |
| Modifier and Type | Method and Description |
|---|---|
| protected Resource | Returns: the Resource handlethe path to the resource path)Overrides org. |
| FileSystemXmlApplicationContext | back to summary |
|---|---|
| public FileSystemXmlApplicationContext() Create a new FileSystemXmlApplicationContext for bean-style configuration. | |
| FileSystemXmlApplicationContext | back to summary |
|---|---|
| public FileSystemXmlApplicationContext(ApplicationContext parent) Create a new FileSystemXmlApplicationContext for bean-style configuration.
| |
| FileSystemXmlApplicationContext | back to summary |
|---|---|
| public FileSystemXmlApplicationContext(String configLocation) throws BeansException Create a new FileSystemXmlApplicationContext, loading the definitions from the given XML file and automatically refreshing the context.
| |
| FileSystemXmlApplicationContext | back to summary |
|---|---|
| public FileSystemXmlApplicationContext(String... configLocations) throws BeansException Create a new FileSystemXmlApplicationContext, loading the definitions from the given XML files and automatically refreshing the context.
| |
| FileSystemXmlApplicationContext | back to summary |
|---|---|
| public FileSystemXmlApplicationContext(String[] configLocations, ApplicationContext parent) throws BeansException Create a new FileSystemXmlApplicationContext with the given parent, loading the definitions from the given XML files and automatically refreshing the context.
| |
| FileSystemXmlApplicationContext | back to summary |
|---|---|
| public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh) throws BeansException Create a new FileSystemXmlApplicationContext, loading the definitions from the given XML files.
| |
| FileSystemXmlApplicationContext | back to summary |
|---|---|
| public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh, ApplicationContext parent) throws BeansException Create a new FileSystemXmlApplicationContext with the given parent, loading the definitions from the given XML files.
| |
| getResourceByPath | back to summary |
|---|---|
| protected Resource getResourceByPath(String path) Overrides org. Resolve resource paths as file system paths. Note Even if a given path starts with a slash, it will get interpreted as relative to the current VM working directory. This is consistent with the semantics in a Servlet container.
| |