subclass that adds common handling
of specified config locations. Serves as base class for XML-based application
context implementations such as
.
| Method from org.springframework.context.support.AbstractRefreshableConfigApplicationContext Detail: |
public void afterPropertiesSet() {
if (!isActive()) {
refresh();
}
}
Triggers #refresh() if not refreshed in the concrete context's
constructor already. |
protected String[] getConfigLocations() {
return (this.configLocations != null ? this.configLocations : getDefaultConfigLocations());
}
Return an array of resource locations, referring to the XML bean definition
files that this context should be built with. Can also include location
patterns, which will get resolved via a ResourcePatternResolver.
The default implementation returns null. Subclasses can override
this to provide a set of resource locations to load bean definitions from. |
protected String[] getDefaultConfigLocations() {
return null;
}
Return the default config locations to use, for the case where no
explicit config locations have been specified.
The default implementation returns null,
requiring explicit config locations. |
protected String resolvePath(String path) {
return SystemPropertyUtils.resolvePlaceholders(path);
}
Resolve the given path, replacing placeholders with corresponding
system property values if necessary. Applied to config locations. |
public void setBeanName(String name) {
if (!this.setIdCalled) {
super.setId(name);
}
}
Sets the id of this context to the bean name by default,
for cases where the context instance is itself defined as a bean. |
public void setConfigLocation(String location) {
setConfigLocations(StringUtils.tokenizeToStringArray(location, CONFIG_LOCATION_DELIMITERS));
}
Set the config locations for this application context in init-param style,
i.e. with distinct locations separated by commas, semicolons or whitespace.
If not set, the implementation may use a default as appropriate. |
public void setConfigLocations(String[] locations) {
if (locations != null) {
Assert.noNullElements(locations, "Config locations must not be null");
this.configLocations = new String[locations.length];
for (int i = 0; i < locations.length; i++) {
this.configLocations[i] = resolvePath(locations[i]).trim();
}
}
else {
this.configLocations = null;
}
}
Set the config locations for this application context.
If not set, the implementation may use a default as appropriate. |
public void setId(String id) {
super.setId(id);
this.setIdCalled = true;
}
|