I would like to get a child object in my Spring IoC application context and set a value on it. How can I do this?
Here is the code equivalent:
// The constructor here instantiates the correct child object
MyContainerBean container = new MyContainerBean();
container.getChild().setValue(someValue);
Do you mean
?
Edit: Based on your response, your problem is that you have a violation of Inversion of Control. Objects don’t create their own dependencies. They allow them to be injected. The best you can do with XML configuration in this case would probably be to create the container, inject it into some object, and have that object make the changes you need. You could also use Java-based configuration to create and configure the container bean as needed.