[JAX-RS] Using CDI for dependency injection in JAX-RS

1. The resource class

 

2. MyService interface

3. MyServiceImpl

4. web.xml (under /WEB-INF/)

5. beans.xml (under /WEB-INF/)

6. Deploy on glassfish! and access it: http://localhost:8080/TestCDI/rest/cdiexample (given that the project name is TestCDI).

Leave a Reply

Your email address will not be published. Required fields are marked *