Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-419

Define stage for Injector in resteasy-guice

XMLWordPrintable

    • Icon: Patch Patch
    • Resolution: Done
    • Icon: Major Major
    • 2.0.RC1
    • 1.2.1.GA
    • None
    • None

      Hello all,
      I have use RESTEasy with Guice in my applications. For technologies integration I used resteasy-guice.
      All works perfect except one point:
      GuiceResteasyBootstrapServletContextListener always create Injector in Stage.DEVELOPMENT. It happens because Guice.createInjector(modules) calls without stage definition. By default Guice use Stage.DEVELOPMENT.
      But in my application I need to create Injector in Stage.PRODUCTION, for all singletons as eager singletons for example.
      But it's not possibility to choose stage in RESTEasy.
      For my apps I have build additional 1.2.1.GA build with such possibility. You can find svn patch in attachments.
      Patch based on resteasy-guice-1.2.1.GA tag.

      Included to patch functionality description:

      1) You can define necessary Stage by context-param
      <context-param>
      <param-name>resteasy.guice.stage</param-name>
      <param-value>PRODUCTION</param-value>
      </context-param>

      2) You can use PRODUCTION, DEVELOPMENT and TOOL values of this param (like names of Stage enum entries).

      3) If resteasy.guice.stage is not defined, Stage.PRODUCTION will be used by default.

      4) If you define wrong value, RuntimeException will be thrown with error description message.

              patriot1burke@gmail.com Bill Burke (Inactive)
              alekseydidik_jira Aleksey Didik (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: