public class MyService implements IService { public void performAction() { System.out.println("Performing action..."); } } public class MyApp { private IService service; public void setService(IService service) { this.service = service; } public void start() { service.performAction(); } } public class Activator implements BundleActivator { public void start(BundleContext context) { MyService service = new MyService(); context.registerService(IService.class.getName(), service, null); MyApp app = new MyApp(); app.setService(service); app.start(); } public void stop(BundleContext context) { } }


上一篇:
下一篇:
切换中文