Question

I am newbie to osgi and it may be the reason of such simple question.

A have a osgi bundle. Inside I have service,activator and pojo. Instance of pojo I create in activator.

How can I pass the reference of pojo to service before anyone uses this service?

The only way that comes to my mind is to access service as a standard service and use default identifier for setter, but it's not so good solution. CDI is not used.

Was it helpful?

Solution

Who creates the instance of the service? If your activator, then pass the POJO to your service directly. If Declatative Services create your service, have the POJO be accessible using static methods from the activator.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top