views:

109

answers:

1

Hi,

I have a custom namespace I'm parsing for a Spring project, and I'm having trouble with RuntimeBeanReferences. I have a class MyClass that takes a List. In my beandef file, I have a bean defined of type MyObject named "MyObj".

In my custom namespace parser, I have code that looks like this:

RootBeanDefinition myBean = new RootBeanDefinition(MyClass.class);        
ConstructorArgumentValues cav = new ConstructorArgumentValues();
List list = new LinkedList();
list.add(new RuntimeBeanReference("MyObj"));
cav.addIndexedArgumentValue(0, list);

However, when I lookup the bean through spring, I get an exception saying it can't convert RuntimeBeanReference to MyObject. Do I need to do something specific to force the reference to be resolved?

thanks,

Jeff

+2  A: 

I just found it. I need to use a ManagedList instead of a regular LinkedList. The ManagedList (and ManagedMap) will have references resolved by Spring.

Jeff Storey
Second that! This is the correct way to do this...
Oliver Gierke