<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>3.3.7</version>
</dependency>
</dependencies>
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Path("/hello")
public class HelloService {
@GET
@Produces("text/plain")
public String sayHello() {
return "Hello, World!";
}
}
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
public class Activator implements BundleActivator {
private ServiceRegistration registration;
public void start(BundleContext bundleContext) throws Exception {
HelloService helloService = new HelloService();
registration =
bundleContext.registerService(HelloService.class.getName(), helloService, null);
}
public void stop(BundleContext bundleContext) throws Exception {
registration.unregister();
}
}