-
runtime dependencies
Hi,
I'm new to Spring, I was wondering that in Spring we mention all the dependencies in configuration xml file.
but what if i want to create instances of other classes at runtime.
I hope my doubt is clear if not please let me know i can explain with an example.
Thanks in advance
Shaila
-
If you have to add new beans at runtime in a total dynamic fashion, you can do this in a programmatic way using BeanDefinition and GenericApplicationContext. In fact, such classes are used internally by Spring when the XML is parsed.
Note that dealing with this classes is both powerful and complex - what exactly is your scenario?
IIRC, there was a similar post a while back - besides working in a programmatic way, one can simply add later other xml configurations to the main application context.