Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsSpringDM - Exporting Spring Bean as Service - Problem with scope
https://www.eclipse.org/forums/index.php/mv/msg/299207/807773/#msg_807773
Im trying to export some spring beans as services, trought SpringDM Application context, and I need export them as prototypes, but it is not working. A singleton instance of the bean is created, and any bundle that makes reference get this instance.
I've read about the "bundle" scope, but this will not solve my problem, because this creates instances of services per bundle, and not by injection call as I need.
I've read from old post, on springsource site, when people says that is a problem with OSGi Service registry (this makes cache of services), but this post is from 2005, and they say to use some kind of proxy as workaround. Is this the unique way?
Thanks by any help!
]]>Eduardo Frazão2012-02-27T01:30:07-00:00Re: SpringDM - Exporting Spring Bean as Service - Problem with scope
https://www.eclipse.org/forums/index.php/mv/msg/299207/807834/#msg_807834
I have facing this problem so given sample osgi bean config, try this one.
All the best .....
]]>karthik elavan2012-02-27T03:56:13-00:00Re: SpringDM - Exporting Spring Bean as Service - Problem with scope
https://www.eclipse.org/forums/index.php/mv/msg/299207/808078/#msg_808078
Only to clarify:
You have an a general interface for Beans exporting services:
-- IServiceCall
This interface haves an getOsgiInterface method that encapsulates the Service real implementation right?
So, you export all your beans as IServiceCall?
On the other side, how you get a reference to the service? Do you pass some filter to get the right implementation, and inject it onto your components?
Thanks!]]>Eduardo Frazão2012-02-27T15:08:44-00:00Re: SpringDM - Exporting Spring Bean as Service - Problem with scope
https://www.eclipse.org/forums/index.php/mv/msg/299207/808665/#msg_808665
ServiceFactory and use that as a prototype generator.
Dmitry]]>Dmitry Sklyut2012-02-28T01:57:58-00:00Re: SpringDM - Exporting Spring Bean as Service - Problem with scope
https://www.eclipse.org/forums/index.php/mv/msg/299207/808998/#msg_808998
But, according to the Docs, the ServiceFactory will return an instance per bundleContext.getService() right? In this case, I will have an instance per bundle, like the scope="bundle" right?
Im my scenario, I will need an instance per injection call, or even better, one instance per "HttpSesssion", when services will be consumed by an action fired by a web request. (95% of the time).
I can solve my problem with the session and prototype beans. In the case of the prototype, I have an instance per call, insted of one instance per injection call (this is was I have opened the bug), but for now, it is enought, and with this workaround I can continue my work!!!
I hope that this thread can help other people with the same issue!!]]>Eduardo Frazão2012-02-28T11:13:31-00:00