|
|
|
@ -1113,11 +1113,10 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto |
|
|
|
List<String> beanNames = new ArrayList<>(this.beanDefinitionNames); |
|
|
|
List<String> beanNames = new ArrayList<>(this.beanDefinitionNames); |
|
|
|
|
|
|
|
|
|
|
|
// Trigger initialization of all non-lazy singleton beans...
|
|
|
|
// Trigger initialization of all non-lazy singleton beans...
|
|
|
|
List<CompletableFuture<?>> futures = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.preInstantiationThread.set(PreInstantiation.MAIN); |
|
|
|
this.preInstantiationThread.set(PreInstantiation.MAIN); |
|
|
|
this.mainThreadPrefix = getThreadNamePrefix(); |
|
|
|
this.mainThreadPrefix = getThreadNamePrefix(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
List<CompletableFuture<?>> futures = new ArrayList<>(); |
|
|
|
for (String beanName : beanNames) { |
|
|
|
for (String beanName : beanNames) { |
|
|
|
RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName); |
|
|
|
RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName); |
|
|
|
if (!mbd.isAbstract() && mbd.isSingleton()) { |
|
|
|
if (!mbd.isAbstract() && mbd.isSingleton()) { |
|
|
|
@ -1127,21 +1126,20 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!futures.isEmpty()) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[0])).join(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (CompletionException ex) { |
|
|
|
|
|
|
|
ReflectionUtils.rethrowRuntimeException(ex.getCause()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
finally { |
|
|
|
finally { |
|
|
|
this.mainThreadPrefix = null; |
|
|
|
this.mainThreadPrefix = null; |
|
|
|
this.preInstantiationThread.remove(); |
|
|
|
this.preInstantiationThread.remove(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!futures.isEmpty()) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[0])).join(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (CompletionException ex) { |
|
|
|
|
|
|
|
ReflectionUtils.rethrowRuntimeException(ex.getCause()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Trigger post-initialization callback for all applicable beans...
|
|
|
|
// Trigger post-initialization callback for all applicable beans...
|
|
|
|
for (String beanName : beanNames) { |
|
|
|
for (String beanName : beanNames) { |
|
|
|
Object singletonInstance = getSingleton(beanName, false); |
|
|
|
Object singletonInstance = getSingleton(beanName, false); |
|
|
|
|