I’m hitting some weird (at least to me) behavior - when I create the underlying object I need to configure it with some beans retrieved from application context (factory is application context aware). Weird part is the different behavior between retrieving bean by name (works - loads necessary autoconfigs) and the type (fails -> dependent config is not loaded).
Copy code
// works - dependent auto config is loaded
val targetBean = applicationContext.getBean("targetBeanName")
// blows up with no bean
val targetBean = applicationContext.getBean(TargetBean::class.java)
Any ideas?
Dariusz Kuc
07/10/2020, 9:47 PM
since this is a factory bean I’d rather autowire by type and not hardcoded bean name
Dariusz Kuc
07/10/2020, 10:01 PM
wondering whether it might be due to the
Copy code
@AutoConfigureAfter(
name = "org.springframework.cloud.autoconfigure.RefreshAutoConfiguration")