As the log says,
Cannot enhance @Configuration bean definition since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor.
So, I think this if block should continue for loop.
Comment From: snicoll
Duplicate of #22992