Closed
Description
After #37905 fix, child context created with SpringApplicationBuilder runs parents runners.
Child context creation code:
SpringApplication springApplication = new SpringApplicationBuilder(childMainClass)
.parent((ConfigurableApplicationContext) applicationContext)
.bannerMode(Banner.Mode.OFF)
.build();
ConfigurableApplicationContext context = springApplication.run();
Code above is executed from parents CommandLineRunner and leads to infinite context recursion. Parents runner creates child context, which invokes parents runner and so on.
Looks like problem is in using context.getBeanProvider(Runner.class)
instead of context.getBeansOfType(ApplicationRunner.class)
in SpringApplication::callRunners