Skip to main content



      Home
Home » Eclipse Projects » Equinox » DS and Spring beans
DS and Spring beans [message #540112] Mon, 14 June 2010 20:29 Go to next message
Eclipse UserFriend
We have a mix of OSGi DS services (Declarative Services components) and
Spring beans and services. Is it possible to use a Spring bean as a
property of a DS service, i.e. inject the Spring bean into the DS
service? Would it help if the Spring bean were declared as a service
using Spring DM?

Craig
Re: DS and Spring beans [message #540169 is a reply to message #540112] Tue, 15 June 2010 04:36 Go to previous messageGo to next message
Eclipse UserFriend
Hi Craig,
using Spring DM it's easy to inject a bean into a service implementation
and vice versa.

I don't think that its possible to inject a Spring bean into a service
component created with Equinox DS as the lifecycle of the object is not
known to Spring.

What you of course can do is publish an OSGi service using Equinox DS
and consume it with Spring DM or vice versa.

Regards,
Stefan.

Craig Foote schrieb:
> We have a mix of OSGi DS services (Declarative Services components) and
> Spring beans and services. Is it possible to use a Spring bean as a
> property of a DS service, i.e. inject the Spring bean into the DS
> service? Would it help if the Spring bean were declared as a service
> using Spring DM?
>
> Craig
Re: DS and Spring beans [message #540306 is a reply to message #540169] Tue, 15 June 2010 11:13 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for replying Stefan, this looks promising.

Regarding exposing a Spring bean as a DM service and consuming it in a DS component service, do you have an example?

Does the DS XML declaration reference the DM service by id or interface? Does the resolution of that dependency require the bundle declaring the Spring bean be started? If so, how should it be started?

I like DS in that the first consumer of the service starts the service bundle automagically while I had problems with DM services not being available if the declaring bundle is not somehow started.

Any help greatly appreciated!

Craig

[Updated on: Tue, 15 June 2010 20:44] by Moderator

Re: DS and Spring beans [message #543423 is a reply to message #540112] Tue, 29 June 2010 07:24 Go to previous message
Eclipse UserFriend
On 06/15/2010 02:29 AM, Craig Foote wrote:
> We have a mix of OSGi DS services (Declarative Services components) and
> Spring beans and services. Is it possible to use a Spring bean as a
> property of a DS service, i.e. inject the Spring bean into the DS
> service? Would it help if the Spring bean were declared as a service
> using Spring DM?
>
> Craig

A long time ago I have created such a example:

http://eclipser-blog.blogspot.com/2008/12/osgi-example-sprin g-dynamic-modules.html

maybe it can be helpful.

best regards,
Bartek
Previous Topic:PDE ignores p2.inf
Next Topic:Bundle stay always in the state "RESOLVED"
Goto Forum:
  


Current Time: Sat Nov 08 13:40:54 EST 2025

Powered by FUDForum. Page generated in 0.03994 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top