Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-742

Implied @Inject on a class with one parameterized constructor

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Obsolete
    • Major
    • None
    • 2.0.SP1
    • Beans
    • None

    Description

      Currently, the specification states these limitations on what classes are beans. Namely it mentions that:

      It has an appropriate constructor - either
      * the class has a constructor with no parameters, or
      * the class declares a constructor annotated @Inject.

      This effectively means that a class which has single constructor that is parameterized and does not have @Inject annotation on it will not become a bean. In fact, it will blow the CDI up. Just like this class:

      @Dependent
      public class Foo {
        // no @Inject annotation and no other constructor present
        public Foo(Bar bar) {
        }
      }
      

      Could we loosen the limitation and in the above case automatically assume (effectively add) the @Inject annotation?

      Attachments

        Activity

          People

            Unassigned Unassigned
            manovotn Matěj Novotný
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: