Brendan,
I just tried out your fix for DWR-37 (parent bean classname). Unfortunately, that fix doesn't quite work for my situation because in my case, the parent bean is defined in a parent BeanFactory and so doesn't show up in the BeanDefinitionRegistry from the ParserContext. I was looking through the Spring API, and there's no really good way to navigate upwards except to cast to BeanFactory to get the parent then back to BeanDefinitionRegistry to get the parent bean def.
This is what I came up with in a few minutes of hacking at it - please feel free to make it better!
private String resolveBeanClassname(BeanDefinition definition, BeanDefinitionRegistry registry)
{
String beanClassName = definition.getBeanClassName();
if (!StringUtils.hasText(beanClassName))
{
while (definition instanceof ChildBeanDefinition )
{
String parentName = ((ChildBeanDefinition)definition).getParentName();
while(registry != null && !registry.containsBeanDefinition(parentName))
{
if(registry instanceof ApplicationContext)
{
registry = (BeanDefinitionRegistry)((ApplicationContext)registry).getParent();
}
else if(registry instanceof AbstractBeanFactory)
{
registry = (BeanDefinitionRegistry)((AbstractBeanFactory)registry).getParentBeanFactory();
}
else
{
break;
}
}
if(registry != null)
{
BeanDefinition parentDefinition = registry.getBeanDefinition(parentName);
beanClassName = parentDefinition.getBeanClassName();
if (StringUtils.hasText(beanClassName )) break;
definition = parentDefinition;
}
}
}
return beanClassName;
}
I've just fixed this. Joe is there a way you can allow me to assign these bugs to myself?
Thanks
Brendan