-
May 26th, 2010, 06:26 AM
#1
Services are not published
Hello,
I am using Spring DM 2.0.0.M1 and I am facing a basic problem (it seems).
In a single bundle:
- I have an interface A
- I have a basic implementation B of this interface A
- I have a consumer C which uses one instance of my service A
In the spring context:
- I create a bean of the basic implementation B and I publish it as a service of my interface A
- I create a bean of my consumer C which uses a required service A.
At runtime, the dependency "C requires A" is created (I saw it in log file), but B is never published as service so C is never available as well.
It works if I make one of the changes:
- I link C with the bean B instead of the service A
- I change the availabilty of the A service in C to "optional"
This shows that globally my project can work.
However, I don't want to link C with B because B is supposed to be an "emergency implementation" (ranking 0).
And I need the A service to be not-null, so the "optional" does not please me.
Have I to publish the B bean in a separate bundle?
-
May 28th, 2010, 03:12 AM
#2
To reach your goal,you should have to publish the B bean in a seperate bundle.
if you insist to push them together, I suggest you to link C with B, B can be lazily created while no matched implementaion is found from the OSGI Services(by catching ServiceUnavailableException).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules