IEventBroker injection into OSGI service component not working. #708

CLOSED
Submitted 3 years ago

The Eclipse Rich Client Training shows the following in the following section; 135.5. Notifications from the TaskService

@Component public class TransientTaskServiceImpl implements TaskService {

@Inject
private IEventBroker broker;

The broker is null.

Is this because the IEclipseContext is not available for injection to OSGI service components in this way?

Comments

  3 years ago

Please see https://learn.vogella.com/exercises/rich-client-platform/using-context-functions-ACy8M#tutorial_contextfunction2 for using context functions. As said earlier OSGI does not support @Inject.

  3 years ago

I added the following text: Dependency inject only works here as we are using the ContextInjectionFactory in our context function implementation. OSGi does not natively support the '@Inject' annotation.

I hope this helps.

  3 years ago

Please reopen if this still does not work for you.

Please login to write a comment.