Merge pull request #11743 from dreis2211
* pr/11743: Narrow scope of some variables
This commit is contained in:
commit
55f44dc510
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2017 the original author or authors.
|
* Copyright 2012-2018 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -160,11 +160,11 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
|
||||||
|
|
||||||
private void addBeanTypeForNonAliasDefinition(String name) {
|
private void addBeanTypeForNonAliasDefinition(String name) {
|
||||||
try {
|
try {
|
||||||
String factoryName = BeanFactory.FACTORY_BEAN_PREFIX + name;
|
|
||||||
RootBeanDefinition beanDefinition = (RootBeanDefinition) this.beanFactory
|
RootBeanDefinition beanDefinition = (RootBeanDefinition) this.beanFactory
|
||||||
.getMergedBeanDefinition(name);
|
.getMergedBeanDefinition(name);
|
||||||
if (!beanDefinition.isAbstract()
|
if (!beanDefinition.isAbstract()
|
||||||
&& !requiresEagerInit(beanDefinition.getFactoryBeanName())) {
|
&& !requiresEagerInit(beanDefinition.getFactoryBeanName())) {
|
||||||
|
String factoryName = BeanFactory.FACTORY_BEAN_PREFIX + name;
|
||||||
if (this.beanFactory.isFactoryBean(factoryName)) {
|
if (this.beanFactory.isFactoryBean(factoryName)) {
|
||||||
Class<?> factoryBeanGeneric = getFactoryBeanGeneric(this.beanFactory,
|
Class<?> factoryBeanGeneric = getFactoryBeanGeneric(this.beanFactory,
|
||||||
beanDefinition, name);
|
beanDefinition, name);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2017 the original author or authors.
|
* Copyright 2012-2018 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -157,10 +157,10 @@ class OnClassCondition extends SpringBootCondition
|
||||||
Class<?> annotationType) {
|
Class<?> annotationType) {
|
||||||
MultiValueMap<String, Object> attributes = metadata
|
MultiValueMap<String, Object> attributes = metadata
|
||||||
.getAllAnnotationAttributes(annotationType.getName(), true);
|
.getAllAnnotationAttributes(annotationType.getName(), true);
|
||||||
List<String> candidates = new ArrayList<>();
|
|
||||||
if (attributes == null) {
|
if (attributes == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
List<String> candidates = new ArrayList<>();
|
||||||
addAll(candidates, attributes.get("value"));
|
addAll(candidates, attributes.get("value"));
|
||||||
addAll(candidates, attributes.get("name"));
|
addAll(candidates, attributes.get("name"));
|
||||||
return candidates;
|
return candidates;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2017 the original author or authors.
|
* Copyright 2012-2018 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -64,7 +64,6 @@ public class EntityScanner {
|
||||||
if (packages.isEmpty()) {
|
if (packages.isEmpty()) {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
Set<Class<?>> entitySet = new HashSet<>();
|
|
||||||
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
|
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
|
||||||
false);
|
false);
|
||||||
scanner.setEnvironment(this.context.getEnvironment());
|
scanner.setEnvironment(this.context.getEnvironment());
|
||||||
|
|
@ -72,6 +71,7 @@ public class EntityScanner {
|
||||||
for (Class<? extends Annotation> annotationType : annotationTypes) {
|
for (Class<? extends Annotation> annotationType : annotationTypes) {
|
||||||
scanner.addIncludeFilter(new AnnotationTypeFilter(annotationType));
|
scanner.addIncludeFilter(new AnnotationTypeFilter(annotationType));
|
||||||
}
|
}
|
||||||
|
Set<Class<?>> entitySet = new HashSet<>();
|
||||||
for (String basePackage : packages) {
|
for (String basePackage : packages) {
|
||||||
if (StringUtils.hasText(basePackage)) {
|
if (StringUtils.hasText(basePackage)) {
|
||||||
for (BeanDefinition candidate : scanner
|
for (BeanDefinition candidate : scanner
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2017 the original author or authors.
|
* Copyright 2012-2018 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -135,7 +135,6 @@ public class ConditionEvaluationReportMessage {
|
||||||
|
|
||||||
private Map<String, ConditionAndOutcomes> orderByName(
|
private Map<String, ConditionAndOutcomes> orderByName(
|
||||||
Map<String, ConditionAndOutcomes> outcomes) {
|
Map<String, ConditionAndOutcomes> outcomes) {
|
||||||
Map<String, ConditionAndOutcomes> result = new LinkedHashMap<>();
|
|
||||||
List<String> names = new ArrayList<>();
|
List<String> names = new ArrayList<>();
|
||||||
Map<String, String> classNames = new HashMap<>();
|
Map<String, String> classNames = new HashMap<>();
|
||||||
for (String name : outcomes.keySet()) {
|
for (String name : outcomes.keySet()) {
|
||||||
|
|
@ -144,6 +143,7 @@ public class ConditionEvaluationReportMessage {
|
||||||
classNames.put(shortName, name);
|
classNames.put(shortName, name);
|
||||||
}
|
}
|
||||||
Collections.sort(names);
|
Collections.sort(names);
|
||||||
|
Map<String, ConditionAndOutcomes> result = new LinkedHashMap<>();
|
||||||
for (String shortName : names) {
|
for (String shortName : names) {
|
||||||
result.put(shortName, outcomes.get(classNames.get(shortName)));
|
result.put(shortName, outcomes.get(classNames.get(shortName)));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,6 @@ public class ServletContextInitializerBeans
|
||||||
|
|
||||||
private <T> List<Entry<String, T>> getOrderedBeansOfType(
|
private <T> List<Entry<String, T>> getOrderedBeansOfType(
|
||||||
ListableBeanFactory beanFactory, Class<T> type, Set<?> excludes) {
|
ListableBeanFactory beanFactory, Class<T> type, Set<?> excludes) {
|
||||||
List<Entry<String, T>> beans = new ArrayList<>();
|
|
||||||
Comparator<Entry<String, T>> comparator = (o1,
|
Comparator<Entry<String, T>> comparator = (o1,
|
||||||
o2) -> AnnotationAwareOrderComparator.INSTANCE.compare(o1.getValue(),
|
o2) -> AnnotationAwareOrderComparator.INSTANCE.compare(o1.getValue(),
|
||||||
o2.getValue());
|
o2.getValue());
|
||||||
|
|
@ -230,6 +229,7 @@ public class ServletContextInitializerBeans
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
List<Entry<String, T>> beans = new ArrayList<>();
|
||||||
beans.addAll(map.entrySet());
|
beans.addAll(map.entrySet());
|
||||||
beans.sort(comparator);
|
beans.sort(comparator);
|
||||||
return beans;
|
return beans;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue