I have a FileSystemXmlApplicationContext
and I would like the beans defined in the XML to take as a constructor argument a bean which is not declared in Spring
For example, I would like to do:
<bean class="some.MyClass">
<constructor-arg ref="myBean" />
</bean>
So I could imagine doing this via something like:
Object myBean = ...
context = new FileSystemXmlApplicationContext(xmlFile);
context.addBean("myBean", myBean); //add myBean before processing
context.refresh();
Except that there is no such method :-( does anyone know how I can achieve this?