In my non-Boot Spring 5 project I need to manually register and initialize some beans. After that I want to add a @Configuration class to context, that imports a config from an external lib:
@Configuration
@Import(ExtLibConfig.class)
public class MyExtLibConfig {
@Bean
public ExtLibBean extLibBean() {
return ExtLibBean.builder().build();
}
}
ExtLibConfig has many of its own @ComponentScan and @Import, and I wish them all to be configured automatically, including my ExtLibBean.
Is it possible to do so in runtime? External lib scans ApplicationContext, and I need it to do so, when my manually registered beans are added.
UPD:
The problem is not actual about beans register order. The ext lib is scanning ApplicationContext after its refresh, so I need my beans to be there at this time