Details

    • Type: Sub-task Sub-task
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.*
    • Fix Version/s: 2.1.*
    • Component/s: None
    • Labels:
      None

      Description

      HK2 needs to be able to delegate injection to Guice.

        Issue Links

          Activity

          Hide
          aluedeke added a comment -

          i created a small sample project on github which shows a possible way to integrate both frameworks using the work from jwells. checkout https://github.com/aluedeke/jersey2-guice-example

          @jwells if you have time could you review it and provide some feedback?

          Show
          aluedeke added a comment - i created a small sample project on github which shows a possible way to integrate both frameworks using the work from jwells. checkout https://github.com/aluedeke/jersey2-guice-example @jwells if you have time could you review it and provide some feedback?
          Hide
          cowwoc added a comment -

          I believe we've got a problem.

          The Jersey 1.x mechanism used the following call-flow:

          Container
          -> GuiceFilter (Guice: initialize request scope)
          -> GuiceServletContextListener (Guice: initialize the Guice injector)
          -> JerseyServletModule (Jersey: bind Jersey types to Guice module)
          -> GuiceContainer (Jersey: redirect incoming requests to resource classes)

          The problem is that the above mechanism requires you to construct an Injector before Jersey sees an incoming request, but the new Jersey 2.x requires us the use of ServiceLocator which is only available after Jersey sees an incoming request.

          How do we resolve this?

          Show
          cowwoc added a comment - I believe we've got a problem. The Jersey 1.x mechanism used the following call-flow: Container -> GuiceFilter (Guice: initialize request scope) -> GuiceServletContextListener (Guice: initialize the Guice injector) -> JerseyServletModule (Jersey: bind Jersey types to Guice module) -> GuiceContainer (Jersey: redirect incoming requests to resource classes) The problem is that the above mechanism requires you to construct an Injector before Jersey sees an incoming request, but the new Jersey 2.x requires us the use of ServiceLocator which is only available after Jersey sees an incoming request. How do we resolve this?
          Hide
          cowwoc added a comment -

          Please reopen this issue until we gain a better understanding of how to use Guice with Jersey 2.x.

          Show
          cowwoc added a comment - Please reopen this issue until we gain a better understanding of how to use Guice with Jersey 2.x.
          Hide
          cowwoc added a comment -

          I opened a separate issue for guice-servlet integration: https://java.net/jira/browse/HK2-121

          The existing unit tests fail to test this functionality and Jersey 2.0 cannot be used with Guice without it.

          Show
          cowwoc added a comment - I opened a separate issue for guice-servlet integration: https://java.net/jira/browse/HK2-121 The existing unit tests fail to test this functionality and Jersey 2.0 cannot be used with Guice without it.
          Hide
          jwells added a comment -

          aluedeke, I looked at your example, it is interesting. Have you used the bridge someplace?

          Show
          jwells added a comment - aluedeke, I looked at your example, it is interesting. Have you used the bridge someplace?

            People

            • Assignee:
              jwells
              Reporter:
              Marek Potociar
            • Votes:
              7 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: