Bundle-ManifestVersion: 2
Bundle-SymbolicName: com.example.service
Bundle-Version: 1.0.0
Export-Package: com.example.service
public interface HelloService {
String sayHello(String name);
}
public class HelloServiceImpl implements HelloService {
@Override
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
public class MyBundleActivator implements BundleActivator {
@Override
public void start(BundleContext context) throws Exception {
HelloService helloService = new HelloServiceImpl();
context.registerService(HelloService.class.getName(), helloService, null);
}
@Override
public void stop(BundleContext context) throws Exception {
}
}