Browse Source

Polish

pull/4801/head
Phillip Webb 10 years ago
parent
commit
f96dea7011
  1. 1
      spring-boot/src/main/java/org/springframework/boot/Banner.java
  2. 5
      spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java
  3. 18
      spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
  4. 1
      spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrar.java
  5. 2
      spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java
  6. 2
      spring-boot/src/main/java/org/springframework/boot/bind/RelaxedDataBinder.java
  7. 1
      spring-boot/src/main/java/org/springframework/boot/bind/YamlJavaBeanPropertyConstructor.java

1
spring-boot/src/main/java/org/springframework/boot/Banner.java

@ -57,6 +57,7 @@ public interface Banner { @@ -57,6 +57,7 @@ public interface Banner {
* Print the banner to the log file.
*/
LOG
}
}

5
spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java

@ -183,10 +183,8 @@ class BeanDefinitionLoader { @@ -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 { @@ -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 { @@ -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 + "'");
}

18
spring-boot/src/main/java/org/springframework/boot/SpringApplication.java

@ -383,17 +383,23 @@ public class SpringApplication { @@ -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 { @@ -407,8 +413,6 @@ public class SpringApplication {
"Cannot instantiate " + type + " : " + name, ex);
}
}
AnnotationAwareOrderComparator.sort(instances);
return instances;
}
@ -420,7 +424,6 @@ public class SpringApplication { @@ -420,7 +424,6 @@ public class SpringApplication {
return new StandardServletEnvironment();
}
return new StandardEnvironment();
}
/**
@ -608,7 +611,6 @@ public class SpringApplication { @@ -608,7 +611,6 @@ public class SpringApplication {
}
}
}
if (this.resourceLoader != null) {
if (context instanceof GenericApplicationContext) {
((GenericApplicationContext) context)

1
spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrar.java

@ -122,6 +122,7 @@ public class SpringApplicationAdminMXBeanRegistrar @@ -122,6 +122,7 @@ public class SpringApplicationAdminMXBeanRegistrar
logger.info("Application shutdown requested.");
SpringApplicationAdminMXBeanRegistrar.this.applicationContext.close();
}
}
}

2
spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java

@ -140,7 +140,9 @@ class RelaxedConversionService implements ConversionService { @@ -140,7 +140,9 @@ class RelaxedConversionService implements ConversionService {
throw new IllegalArgumentException("No enum constant "
+ this.enumType.getCanonicalName() + "." + source);
}
}
}
}

2
spring-boot/src/main/java/org/springframework/boot/bind/RelaxedDataBinder.java

@ -629,6 +629,7 @@ public class RelaxedDataBinder extends DataBinder { @@ -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 { @@ -645,6 +646,7 @@ public class RelaxedDataBinder extends DataBinder {
public String toString() {
return "." + this.name;
}
}
}

1
spring-boot/src/main/java/org/springframework/boot/bind/YamlJavaBeanPropertyConstructor.java

@ -65,7 +65,6 @@ public class YamlJavaBeanPropertyConstructor extends Constructor { @@ -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…
Cancel
Save