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]
No comments:
Post a Comment
If you have any doubts or questions, please let us know.