Search code examples
osgiosgi-bundlekarafdeclarative-servicesonos

How can I get current bundle's BundleContext instance while using declarative services in karaf 3.0.2


In ONOS on karaf 3.0.2, I wish to get current bundle's BundleContext instance for tracking bundle's status and configuring it. But ONOS uses declarative service, so I cannot use function like BundleContext.getServiceReference() to get it. Could anyone help me ?


Solution

  • You can inject the BundleContext in an @Activate method when using DS.