David Mkrtchyan
David Mkrtchyan

Reputation: 1

How to inject osgi service with felix scr annotations

I have a osgi bundle in felix contanier, that exports service

@Component(label= "App Service",
    description = "App Service",
    immediate = true, enabled = true, metatype=true)
@Service(AppServiceImpl.class)
public class AppServiceImpl implements AppService {
}

in web console I see that service starts normally.

Then I want to inject it with @Reference felix scr annotation in other bundle. I understand that there should be some injector, but could not find it.

Upvotes: 0

Views: 482

Answers (2)

Dmitry
Dmitry

Reputation: 154

If you use maven, make sure you have the following instruction in your pom.xml: <_dsannotations>*</_dsannotations> SCR annotations will not work without that.

Upvotes: 0

BJ Hargrave
BJ Hargrave

Reputation: 9384

Are you running the Felix SCR bundle? It is the "injector" as it processes the XML generated from these annotations by the tools that assembled your bundles.

Upvotes: 0

Related Questions