Announcement Announcement Module
Collapse

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
ServiceReference not injecting Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ServiceReference not injecting

    Hi ppl, here is the pblm: I have 2 OSGi service I'm exposing in a given bundle:

    Code:
    <osgi:service 
       id="myOsgiService"
       interface="com.my.company.SomeDao" 
       ref="daoImplConfig1" />
    	
    <osgi:service 
       id="myOsgiService2" 
       interface="com.my.company.SomeDao" 
       ref="daoImplConfig2" />
    Now, I want to wire these two services. I can't do it as I usually do: by simple interface induction. So I'm trying to do:

    Code:
    @ServiceReference(serviceBeanName="myOsgiService")
    public void setDao(SomeDao someDao) {
    ...
    }
    
    // AND
    
    @ServiceReference(serviceBeanName="myOsgiService2")
    public void setOtherDao(SomeDao someDao) {
    ...
    }
    However, both end up being null, not injected.

    Am I using the annotation correctly? (I do have the annotation post-processor in my context).

    Thanks for your help.

    JS.

  • #2
    Originally posted by jsbournival View Post
    Hi ppl, here is the pblm: I have 2 OSGi service I'm exposing in a given bundle:

    Code:
    <osgi:service 
       id="myOsgiService"
       interface="com.my.company.SomeDao" 
       ref="daoImplConfig1" />
    	
    <osgi:service 
       id="myOsgiService2" 
       interface="com.my.company.SomeDao" 
       ref="daoImplConfig2" />
    Now, I want to wire these two services. I can't do it as I usually do: by simple interface induction. So I'm trying to do:

    Code:
    @ServiceReference(serviceBeanName="myOsgiService")
    public void setDao(SomeDao someDao) {
    ...
    }
    
    // AND
    
    @ServiceReference(serviceBeanName="myOsgiService2")
    public void setOtherDao(SomeDao someDao) {
    ...
    }
    However, both end up being null, not injected.

    Am I using the annotation correctly? (I do have the annotation post-processor in my context).

    Thanks for your help.

    JS.
    IIRC serviceBeanName is not the id of the service its the id of the bean that the service exposes. so I think in your case its daoImplConfig1 etc.

    Comment

    Working...
    X