OSGI Services without annotation

 

 [code language=”java”] BundleContext bundleContext = FrameworkUtil.getBundle(YourClass.class).getBundleContext(); //alternate to @Reference private ResourceResolverFactory resolverFactory;ServiceReference factoryRef = bundleContext.getServiceReference(ResourceResolverFactory.class.getName()); resolverFactory = (ResourceResolverFactory) bundleContext.getService(factoryRef); //alternate to @Reference private CustomPageManager customPageManager ServiceReference articleRef = bundleContext.getServiceReference(CustomPageManager.class.getName()); customPageManager = (CustomPageManager.) bundleContext.getService(articleRef); [/code]

Read More