Code formatting
This commit is contained in:
parent
9e18183dd5
commit
be79da139e
|
|
@ -154,7 +154,8 @@ class BeanDefinitionLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int load(CharSequence source) {
|
private int load(CharSequence source) {
|
||||||
String sourceString = xmlReader.getEnvironment().resolvePlaceholders(source.toString());
|
String sourceString = this.xmlReader.getEnvironment().resolvePlaceholders(
|
||||||
|
source.toString());
|
||||||
try {
|
try {
|
||||||
// Use class utils so that period separated nested class names work
|
// Use class utils so that period separated nested class names work
|
||||||
return load(ClassUtils.forName(sourceString, null));
|
return load(ClassUtils.forName(sourceString, null));
|
||||||
|
|
@ -163,37 +164,40 @@ class BeanDefinitionLoader {
|
||||||
// swallow exception and continue
|
// swallow exception and continue
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceLoader loader = this.resourceLoader != null ?
|
ResourceLoader loader = this.resourceLoader != null ? this.resourceLoader
|
||||||
this.resourceLoader : DEFAULT_RESOURCE_LOADER;
|
: DEFAULT_RESOURCE_LOADER;
|
||||||
|
|
||||||
int loadCount = 0;
|
int loadCount = 0;
|
||||||
if( loader instanceof ResourcePatternResolver ) {
|
if (loader instanceof ResourcePatternResolver) {
|
||||||
// Resource pattern matching available.
|
// Resource pattern matching available.
|
||||||
try {
|
try {
|
||||||
Resource[] resources = ((ResourcePatternResolver) loader).getResources(sourceString);
|
Resource[] resources = ((ResourcePatternResolver) loader)
|
||||||
for(Resource resource : resources) {
|
.getResources(sourceString);
|
||||||
if( resource.exists() ) {
|
for (Resource resource : resources) {
|
||||||
|
if (resource.exists()) {
|
||||||
loadCount += load(resource);
|
loadCount += load(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex) {
|
catch (IOException ex) {
|
||||||
throw new BeanDefinitionStoreException(
|
throw new BeanDefinitionStoreException(
|
||||||
"Could not resolve bean definition resource pattern [" + sourceString + "]", ex);
|
"Could not resolve bean definition resource pattern ["
|
||||||
|
+ sourceString + "]", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !(loader instanceof ResourcePatternResolver) ) {
|
if (!(loader instanceof ResourcePatternResolver)) {
|
||||||
// Can only load single resources by absolute URL.
|
// Can only load single resources by absolute URL.
|
||||||
Resource loadedResource = loader.getResource(sourceString);
|
Resource loadedResource = loader.getResource(sourceString);
|
||||||
if (loadedResource != null && loadedResource.exists()) {
|
if (loadedResource != null && loadedResource.exists()) {
|
||||||
return load(loadedResource);
|
return load(loadedResource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( loadCount > 0 ) {
|
if (loadCount > 0) {
|
||||||
return loadCount;
|
return loadCount;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Attempt to treat the source as a package name, common to all PatternResolver types
|
// Attempt to treat the source as a package name, common to all
|
||||||
|
// PatternResolver types
|
||||||
Package packageResource = findPackage(source);
|
Package packageResource = findPackage(source);
|
||||||
if (packageResource != null) {
|
if (packageResource != null) {
|
||||||
return load(packageResource);
|
return load(packageResource);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue