-
Jul 16th, 2012, 08:09 AM
#1
Core and Local beans
Hi,
I have an application where I'd like to distinguish between "core" beans and what I call "local" beans.
Core beans are provided and used by the applications core, typically specified in a small bean defintion file that is
generated by the programmers of the core. The "local" beans are typically plugins, extensions, or the like and specified in a second bean definition file, which is under the control of the core users, or local administrators.
I can achieve most of that by using something like
new ClassPathXmlApplicationContext("spring-beans-core.xml", "spring-beans-local.xml");
One thing is missing, though: As soon as the core beans are loaded, (or, in other words, after "spring-beans-core.xml" is loaded, an not after both are loaded) I'd have something like a core initializationmethod. Can I
get that somehow?
Thanks,
Jochen
-
Jul 18th, 2012, 03:19 PM
#2
No ideas? Or, on't you guys get my question? I'm trying to rephrase:
I'd like to initialize an application context by reading bean definitions from a file, then do some programmatical initialization and,
finally, add more bean definitions from another file. Can I do that? ClasspathXmlApplicationcontext seems generally right, except
that it insists in reading all the files at once.
Thanks,
Jochen
-
Jul 19th, 2012, 01:46 AM
#3
Maybe answering my own question: I am now using a ClasspathXmlApplicationContext with a parent. The parent is created using the first resource file, the other context using the second. Looks good so far...
-
Jul 19th, 2012, 11:18 AM
#4
hi,
Instead of programatically referring to second bean xml, use the facility that spring has provided to refer one bean definition into other. Hence you can refer second bean difinition into the ifest bean file, further spring will take care of instantiating and initializing.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules