Polish
This commit is contained in:
parent
35efb251e0
commit
f96dea7011
|
|
@ -57,6 +57,7 @@ public interface Banner {
|
|||
* Print the banner to the log file.
|
||||
*/
|
||||
LOG
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,10 +183,8 @@ class BeanDefinitionLoader {
|
|||
}
|
||||
|
||||
private int load(CharSequence source) {
|
||||
|
||||
String resolvedSource = this.xmlReader.getEnvironment()
|
||||
.resolvePlaceholders(source.toString());
|
||||
|
||||
// Attempt as a Class
|
||||
try {
|
||||
return load(ClassUtils.forName(resolvedSource, null));
|
||||
|
|
@ -197,7 +195,6 @@ class BeanDefinitionLoader {
|
|||
catch (ClassNotFoundException ex) {
|
||||
// swallow exception and continue
|
||||
}
|
||||
|
||||
// Attempt as resources
|
||||
Resource[] resources = findResources(resolvedSource);
|
||||
int loadCount = 0;
|
||||
|
|
@ -211,13 +208,11 @@ class BeanDefinitionLoader {
|
|||
if (atLeastOneResourceExists) {
|
||||
return loadCount;
|
||||
}
|
||||
|
||||
// Attempt as package
|
||||
Package packageResource = findPackage(resolvedSource);
|
||||
if (packageResource != null) {
|
||||
return load(packageResource);
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Invalid source '" + resolvedSource + "'");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -383,17 +383,23 @@ public class SpringApplication {
|
|||
return getSpringFactoriesInstances(type, new Class<?>[] {});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> Collection<? extends T> getSpringFactoriesInstances(Class<T> type,
|
||||
Class<?>[] parameterTypes, Object... args) {
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
// Use names and ensure unique to protect against duplicates
|
||||
Set<String> names = new LinkedHashSet<String>(
|
||||
SpringFactoriesLoader.loadFactoryNames(type, classLoader));
|
||||
List<T> instances = new ArrayList<T>(names.size());
|
||||
List<T> instances = createSpringFactoriesInstances(type, parameterTypes,
|
||||
classLoader, args, names);
|
||||
AnnotationAwareOrderComparator.sort(instances);
|
||||
return instances;
|
||||
}
|
||||
|
||||
// Create instances from the names
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> List<T> createSpringFactoriesInstances(Class<T> type,
|
||||
Class<?>[] parameterTypes, ClassLoader classLoader, Object[] args,
|
||||
Set<String> names) {
|
||||
List<T> instances = new ArrayList<T>(names.size());
|
||||
for (String name : names) {
|
||||
try {
|
||||
Class<?> instanceClass = ClassUtils.forName(name, classLoader);
|
||||
|
|
@ -407,8 +413,6 @@ public class SpringApplication {
|
|||
"Cannot instantiate " + type + " : " + name, ex);
|
||||
}
|
||||
}
|
||||
|
||||
AnnotationAwareOrderComparator.sort(instances);
|
||||
return instances;
|
||||
}
|
||||
|
||||
|
|
@ -420,7 +424,6 @@ public class SpringApplication {
|
|||
return new StandardServletEnvironment();
|
||||
}
|
||||
return new StandardEnvironment();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -608,7 +611,6 @@ public class SpringApplication {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.resourceLoader != null) {
|
||||
if (context instanceof GenericApplicationContext) {
|
||||
((GenericApplicationContext) context)
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ public class SpringApplicationAdminMXBeanRegistrar
|
|||
logger.info("Application shutdown requested.");
|
||||
SpringApplicationAdminMXBeanRegistrar.this.applicationContext.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,9 @@ class RelaxedConversionService implements ConversionService {
|
|||
throw new IllegalArgumentException("No enum constant "
|
||||
+ this.enumType.getCanonicalName() + "." + source);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -629,6 +629,7 @@ public class RelaxedDataBinder extends DataBinder {
|
|||
public String toString() {
|
||||
return "[" + this.name + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class PropertyNode extends PathNode {
|
||||
|
|
@ -645,6 +646,7 @@ public class RelaxedDataBinder extends DataBinder {
|
|||
public String toString() {
|
||||
return "." + this.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ public class YamlJavaBeanPropertyConstructor extends Constructor {
|
|||
*/
|
||||
protected final void addPropertyAlias(String alias, Class<?> type, String name) {
|
||||
Map<String, Property> typeMap = this.properties.get(type);
|
||||
|
||||
if (typeMap == null) {
|
||||
typeMap = new HashMap<String, Property>();
|
||||
this.properties.put(type, typeMap);
|
||||
|
|
|
|||
Loading…
Reference in New Issue