Results 1 to 4 of 4

Thread: Core and Local beans

  1. #1
    Join Date
    Feb 2012
    Posts
    11

    Default 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

  2. #2
    Join Date
    Feb 2012
    Posts
    11

    Default

    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

  3. #3
    Join Date
    Feb 2012
    Posts
    11

    Default

    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...

  4. #4

    Default

    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
  •