I think here no need to traverse no singleton bean names.
for (String beanName : beanNames) { Object singletonInstance = getSingleton(beanName); if (singletonInstance instanceof SmartInitializingSingleton) { StartupStep smartInitialize = this.getApplicationStartup().start("spring.beans.smart-initialize") .tag("beanName", beanName); SmartInitializingSingleton smartSingleton = (SmartInitializingSingleton) singletonInstance; if (System.getSecurityManager() != null) { AccessController.doPrivileged((PrivilegedAction
Comment From: bclozel
If you believe you've found an improvement, please send a PR explaining the change in greater details. Note that the changes must pass the entire test suite. You'll find more information in the CONTRIBUTING document. Thanks!