Announcement Announcement Module

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
How to import context file in a bundle? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to import context file in a bundle?


    I am working on Spring DM bundles. I have a core services bundle which has bean definitions for the core services. I have some dependent modules which are also bundles.

    How can I import the bean definition file in the context file for dependent bundles?

    I tried using the following.

    <import resource="classpath:com.arisglobal.aglite.config.aglite-beans-config.xml" />
    However it didn't work. Is there anything wrong I am doing here?

    Please let me know of any pointers.


  • #2

    Can somebody please reply if you have any pointers to this?



    • #3
      Hi Shashi,

      I think that it isn't a good approach to try to import Spring XML configuration files from other bundles. As a matter of fact, with Spring DM, each bundle has its own embedded Spring container and, with OSGi, you need to handle dynamics.

      Keep also in mind that you won't be able to hide necessary classes to build beans if you try to import resources. The idea of OSGi is to provide only things you want and hide implementations...

      On the other side, you can make interact different beans between bundles thanks to the OSGi service registry. In fact, it's the only way to do that which takes the dynamic nature of OSGi into account.

      For instance, in bundle1, you can use:
      <osgi:service .../>
      and in bundle2, you can use:
      <osgi:reference .../>

      Hope it helps you,


      • #4
        Hi Thierry,

        Thanks. I will keep that in mind.



        • #5
          Adding to what Thierry said, if you do want to split your application across multiple bundles then either consider modularizing your app as well so that each bundle contains a runtime component. If that's not the case, the consider using fragments instead.
          The idea is to use the intended lifecycle granularity offered by OSGi - since each bundle has its own lifecycle, then it's entirely possible to uninstall a 'slave' bundle while the master one still runs which yields a lot of management problems.
          Of course, you can also try dm Server which nicely solves this for your (among numerous other things).