0
votes

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.

2
You can normally inject this service in another OSGI service (or Servlet) using @Reference annotation. As far as I know. you don't need injection.Abie

2 Answers

0
votes

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.

0
votes

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