| Blueprint missing @ServiceReference annotation [message #903204] |
Wed, 22 August 2012 09:48  |
Erko Knoll Messages: 5 Registered: December 2011 |
Junior Member |
|
|
Spring DM had @ServiceReference annotation alternative to XML service injection which was really nice. The problem is that this annotation is nowhere to be found with blueprint release.
I know that they state that "The plans for the Maven archetype and annotation extension are undefined for the moment." is reasonable explanation, but for some reason some of the references are still existing such as "org.eclipse.gemini.blueprint.extensions.annotation" package use can be found from multiple sources except the .jar itself that contains it. For example "org.eclipse.gemini.blueprint.extender.internal.support.OsgiAnnotationPostProcessor" tries to load "org.eclipse.gemini.blueprint.extensions.annotation.ServiceReferenceInjectionBeanPostProcessor" class which was used for Spring DM only the base package is renamed.
I also tried to add old spring.osgi core, extender and io bundles to get the annotations working but that resulted in massive "Required 'bundleContext' property was not set." exceptions.
Server: Virgo 3.5.0
My question is: how am I supposed to make it work without that annotation (I don't want to go back to XML configuration, defeats the purpose of having Spring 3)?
|
|
|
|
| Re: Blueprint missing @ServiceReference annotation [message #903415 is a reply to message #903359] |
Thu, 23 August 2012 10:36   |
Erko Knoll Messages: 5 Registered: December 2011 |
Junior Member |
|
|
Thanks for the answer. I kind of suspected that they are not present. So I ported over that feature myself.
Basically what I did is I got rid of depreciated stuff and replaced the cardinality logic with availability.
Works the same way as it did before but now cardinality annotation property takes Availability enum. Like this @ServiceRerefence(cardinality=Availability.MANDATORY). Also the base package has been renamed to org.eclipse.gemini.blueprint.extensions.annotation.
Works for my project. Would be really nice if someone who comprehends the Blueprint more than me reviewed it. I just started yesterday to port my project from Spring DM over to Blueprint.
If you Blueprint guys think that could be useful for someone else feel free to take the source and add to your sub-project.
[Updated on: Sun, 26 August 2012 08:41] Report message to a moderator
|
|
|
|
| Re: Blueprint missing @ServiceReference annotation [message #1072295 is a reply to message #903415] |
Mon, 22 July 2013 09:27  |
Roger Stocker Messages: 16 Registered: July 2009 |
Junior Member |
|
|
I'd like to use your ServiceReference annotation, but I need some more information, because in my setup it is ignored.
The extensions bundle is in state active, as expected, and I have a bean using @ServiceReference for a valid OSGi Service, but it's not injected.
What else do I have to do in order to let Spring do the postprocessing?
Thanks
|
|
|
Powered by
FUDForum. Page generated in 0.09680 seconds