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

Provide support for CDI beans as JAX-RS components

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 2.0-beta-3
    • None
    • None
    • None
    • Release Notes

    Description

      I created this module to enable CDI beans to serve as JAX-RS resources, providers and javax.ws.rs.core.Application subclasses. The module registers custom InjectorFactory implementation which obtains CDI beans instead of creating new class instances. By default, every JAX-RS resource is a @RequestScoped CDI bean. Providers and Application subclasses are @ApplicationScoped beans. This can be changed by annotating the class with desired scope annotation.

      Besides the module, minor modification of ResteasyBootstrap is required (see resteasy-cdi-deployment.patch). resteasy-cdi-war is a testing web application.

      What works:

      • CDI field injection
      • CDI constructor injection
      • CDI initializer injection
      • all the other CDI features (interception of lifecycle events and method invocations, alternatives, ...)
      • JAX-RS setter injection
      • JAX-RS method injection

      What does not currently work:

      • JAX-RS field injection (https://jira.jboss.org/jira/browse/WELD-436)
      • JAX-RS constructor injection (the spec says that this is non-portable anyway)
      • support for Application subclasses (requires trivial change in RESTEasy)

      tested with JBoss AS 6 20100215-M2

      Attachments

        Activity

          People

            patriot1burke@gmail.com Bill Burke (Inactive)
            rhn-engineering-jharting Jozef Hartinger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: