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
Making two services that consume each other? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Making two services that consume each other?


    Im new to Spring DM...

    Im working on converting an existing spring MVC project to a set of bundles.

    Now i want to know if its posible to have 2 bundles A and B where

    A injects one type of service into B and
    B injects another service into A

    So far i've not found any work arounds to this problem

    thx in advance

  • #2
    Hi folsgaard,
    I think what you describe is possible.
    You can have Bundle A exposing service A, and using service B; and Bundle B exposing service B and using service A.
    This will work if one of the service import is declared as optional, so that, when you deploy the bundles on the platform, the dependency constraints can be resolved.

    The spring dm files will look like :
    Bundle A file :
    <bean name="A" class="ServiceA">
        <property name="b" ref="serviceB">
    <osgi:reference interface="IServiceB" id="serviceB" cardinality="0..1"/>
    <osgi:service interface="IServiceA" ref="A"/>
    Bundle B file :
    <bean name="B" class="ServiceB">
        <property name="a" ref="serviceA">
    <osgi:reference interface="IServiceA" id="serviceA"/>
    <osgi:service interface="IServiceB" ref="B"/>
    In this case, you need to start Bundle A before Bundle B. The reference to service B being optional, bundle A will be able to start, and then, Bundle B will be able to start also (as service A is available).

    Hope this helped.



    • #3
      thx... that was exactly what i had in mind.