You can use CXF-DOSGi to register your rest resource. You just need to add some properties to your example component to make it work.

See
https://github.com/apache/cxf-dosgi/tree/master/samples

There is a also a bndrun file to easily run and package CXF-DOSGi for bndtools.
https://github.com/apache/cxf-dosgi/tree/master/samples/soap

Christian

On 03.11.2016 03:05, Tanvir wrote:
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();
    }
}



--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to