Uploaded image for project: 'XWiki Commons'
  1. XWiki Commons
  2. XCOMMONS-701

Add a new annotation to tell the Component Manager to automatically inject the result of a Factory

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 6.3
    • Fix Version/s: None
    • Component/s: Component
    • Labels:
      None
    • Similar issues:

      Description

      Right now we already support injecting the result of a Factory by using the @Provider annotation (equivalent of the @Instance annotation in CDI, which extends @Provider from javax.inject). For example:

      @Inject
      @Named("context")
      private Provider<ComponentManager> cmProvider;
      

      Here the idea is to be able to simply write:

      @Inject
      @Named("context")
      private ComponentManager cm;
      

      And if some class exists and has a special annotation (like @Producer) or some method annotated with @Produces (as it's in CDI, see https://docs.jboss.org/weld/reference/1.0.0/en-US/html/producermethods.html) then the result of that method is automatically injected.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Date of First Response: