I have a REST resource class, say Employees, and I need access to another service using DS. Hence I have to make this call a component. Now objects instantiated by @component and JAX-RS Servlet are not same.

I do not want to use static reference to the service as shown below. How this can be handled?

-----------------------------------------------
@Component
@Path("employees")
public class EmployeeResource {
    static MyService service;
    @Reference
    void setMyService(MyService s) {
       service = s;
    }

    @GET
    @Produces("text/plain")
    public String getEmployees() {
        return service.get();
    }
}

--
Best,
Tanvir

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to