8
Jersey 2.0的依赖注入
从没有任何Jersey 1.x知识的白手起家,我很难理解如何在Jersey 2.0项目中设置依赖项注入。 我也知道HK2在Jersey 2.0中可用,但是我似乎找不到帮助Jersey 2.0集成的文档。 @ManagedBean @Path("myresource") public class MyResource { @Inject MyService myService; /** * Method handling HTTP GET requests. The returned object will be sent * to the client as "text/plain" media type. * * @return String that will be returned as a text/plain response. */ @GET …