hello! :wave: while working on custom `FactoryBean...
# spring
d
hello! 👋 while working on custom
FactoryBean
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?
since this is a factory bean I’d rather autowire by type and not hardcoded bean name
wondering whether it might be due to the
Copy code
@AutoConfigureAfter(
		name = "org.springframework.cloud.autoconfigure.RefreshAutoConfiguration")
on the troublesome autoconfig
*i.e. other beans are fetched fine