Results 1 to 3 of 3

Thread: Bean dependency spanning bundles?

  1. #1
    Join Date
    Apr 2009
    Posts
    5

    Default Bean dependency spanning bundles?

    Hi!

    my application is composed of several DM-powered bundles and I need to split some funcionality in different bundles. E.g., I have a bundle "server.core" that is setting up the database and a bundle "server.remote" that enables remote communication for the server. Obviously, the bean definitions should be processed before than all the bean definitions in the "server.remote" bundle. I have already tried to define the "depends-on" attribute for the beans in "server.remote", but Spring isn't able to find them (I assume they are intended as local references).

    Has anybody tips for me ?

    Daniel

  2. #2
    Join Date
    Aug 2004
    Location
    France - Saint Nazaire
    Posts
    79

    Default

    Hi Daniel,

    Do you expose the needed beans by the server.remote bundle as OSGi services? As a matter of fact, each bundle contains its own and independent Spring container and you can't do dependency injection between them with classic Spring reference... The best practise to make a bundle use beans of another bundle is to use the OSGi service registry. The latter allows making the link and provide a robust way to correctly handle OSGi dynamics (helped by Spring DM!)

    Otherwise, if you want to force the start up of your server.core bundle before your server.remote bundle, you can use the startlevel feature of OSGi.

    Hope it helps you!
    Thierry

  3. #3
    Join Date
    Apr 2009
    Posts
    5

    Default

    Quote Originally Posted by templth View Post
    Hi Daniel,

    Do you expose the needed beans by the server.remote bundle as OSGi services? As a matter of fact, each bundle contains its own and independent Spring container and you can't do dependency injection between them with classic Spring reference... The best practise to make a bundle use beans of another bundle is to use the OSGi service registry. The latter allows making the link and provide a robust way to correctly handle OSGi dynamics (helped by Spring DM!)

    Otherwise, if you want to force the start up of your server.core bundle before your server.remote bundle, you can use the startlevel feature of OSGi.

    Hope it helps you!
    Thierry
    Yes, that helped a lot. Now I understand how this has to be done! I already knew that OSGI services can define dependencies, but what I was missing is the fact that you can create local "proxies" to bean services with "osgi:reference" !

    Now everything works fine and as expected - Thank you very much!

    Daniel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •