-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Allard Buijze opened SPR-10736 and commented
I use a custom namespace, and have some BeanDefinitionParsers that generate bean definitions. In one case, I need a single xml element to produce multiple bean definitions. It seems to work just fine by registering the non-primary beans using the parerContext->beanDefinitionRegistry.
However, when a bean has a dependency on one of these non-primary beans using the bean id as value in @Qualifier
, the bean is not found. If I use ApplicationContext.getBean, I can find it. Strangely, if I use the @Autowired
and @Qualifier
in a junit unit test(with SpringJunit4Runner), they are properly injected.
This worked in Spring 3.1.x, but doesn't in 3.2.x. I've doublechecked the documentation to ensure that I didn't do something that made it work 'accidentally' in 3.1. Couldn't find anything.
- Update --
Further investigation revealed that the fact that I am using a BeanDefinition using "factoryBeanName" and "factoryMethodName" has to do with the error. When using a FactoryBean instead, the problem is circumvented. This may mean it has nothing to do with (non-)primary beans, but more with the dependency resolution and the factoryMethod way of defining beans.
Affects: 3.2 GA, 3.2.1, 3.2.2, 3.2.3