Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.1
-
None
Description
We have beans defined that are abstract and cannot be instantiated.
JCAContainer attempts to instantiate all beans with:
for (int i = 0; i < names.length; i++)
{ // TODO one day we could be smart to only pre-load the correct // types of bean, based on the definitions? String name = names[i]; beanFactory.getBean(name); }Result is a BeanIsAbstractException:
org.springframework.beans.factory.BeanIsAbstractException: Error creating bean with name 'baseXlParser': Bean definition is abstract
at org.springframework.beans.factory.support.AbstractBeanFactory.checkMergedBeanDefinition(AbstractBeanFactory.java:653)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
at org.codehaus.activemq.jca.JCAContainer.afterPropertiesSet(JCAContainer.java:77)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1065)
Perhaps something like:
} else if (!lazyLoad && beanFactory instanceof BeanDefinitionRegistry) {
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
String[] names = registry.getBeanDefinitionNames();
for (int i = 0; i < names.length; i++)
}
The TO-DO in the code is well stated, what logic can be implemented to selectively get the necesssay beans? The end result is that lazy-init singletons will be instantiated as well, perhaps without cause.
Also, I believe the code should use BeanFactoryUtils.beanNamesIncludingAncestors(ListableBeanFactory) to account for a potential hierarchy.
Note I found reference to this exact issue in the Spring Forum (http://forum.springframework.org/viewtopic.php?t=3064) but was unable to find an existing jira issue.
Thanks,
Andrew
Attachments
Attachments
Issue Links
- is duplicated by
-
AMQ-220 abstract Spring beans and JCAContainer
- Resolved