Details

    • Type: Feature Request
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.0
    • Fix Version/s: TBD
    • Component/s: Concepts
    • Labels:
      None

      Gliffy Diagrams

        Activity

        Hide
        struberg Mark Struberg added a comment - - edited

        any news on that?
        This would also change a few serializable/passivationCapable definitions like e.g 6.6.4

        Show
        struberg Mark Struberg added a comment - - edited any news on that? This would also change a few serializable/passivationCapable definitions like e.g 6.6.4
        Hide
        pmuir Pete Muir added a comment -

        Do we want to do this? What are the use cases?

        Show
        pmuir Pete Muir added a comment - Do we want to do this? What are the use cases?
        Hide
        jharting Jozef Hartinger added a comment -

        Now that we have injection into enums in place this would be quite similar I think.

        Show
        jharting Jozef Hartinger added a comment - Now that we have injection into enums in place this would be quite similar I think.
        Hide
        pmuir Pete Muir added a comment -

        Deferring, the use cases for this are limited.

        Show
        pmuir Pete Muir added a comment - Deferring, the use cases for this are limited.
        Hide
        jkremser Jirka Kremser added a comment - - edited

        Competitor has it https://google.github.io/guice/api-docs/latest/javadoc/index.html?com/google/inject/spi/StaticInjectionRequest.html

        I can imagine following use case:
        Some kind of utility class with all the method static that would like to use some injected field.

        Show
        jkremser Jirka Kremser added a comment - - edited Competitor has it https://google.github.io/guice/api-docs/latest/javadoc/index.html?com/google/inject/spi/StaticInjectionRequest.html I can imagine following use case: Some kind of utility class with all the method static that would like to use some injected field.
        Hide
        mkouba Martin Kouba added a comment -

        Note that the enum support was dropped, mainly because:

        There is a problem with the injection part if the enum is shared across multiple CDI applications.

        See also CDI-293. I think there might be similar problems with static injection.

        Show
        mkouba Martin Kouba added a comment - Note that the enum support was dropped, mainly because: There is a problem with the injection part if the enum is shared across multiple CDI applications. See also CDI-293 . I think there might be similar problems with static injection.
        Hide
        vsevolodgolovanov Vsevolod Golovanov added a comment -

        The "Forum Reference" link is dead, quoting relevant part here.

        Injection for static members has a couple of problems:

        • A class can be shared between multiple applications, and the Java EE spec does not define rules for this.
        • Outside Java EE, it's difficult to define exactly when a static member is injected.

        Nevertheless, there are a couple of great usecases for this:

        • logger injection,
        • injection for entity classes, and
        • injection into objects with a passivating scope.

        So we do need to support something here. Perhaps it would be enough to say:

        • no static injection in shared libraries, and
        • static fields are injected before the very first instance of a bean is instantiated (but then static injection would not be supported for non-bean classes).

        https://web.archive.org/web/20130529234448/http://www.seamframework.org/Weld/DependencyInjectionWishlist

        Show
        vsevolodgolovanov Vsevolod Golovanov added a comment - The "Forum Reference" link is dead, quoting relevant part here. Injection for static members has a couple of problems: A class can be shared between multiple applications, and the Java EE spec does not define rules for this. Outside Java EE, it's difficult to define exactly when a static member is injected. Nevertheless, there are a couple of great usecases for this: logger injection, injection for entity classes, and injection into objects with a passivating scope. So we do need to support something here. Perhaps it would be enough to say: no static injection in shared libraries, and static fields are injected before the very first instance of a bean is instantiated (but then static injection would not be supported for non-bean classes). https://web.archive.org/web/20130529234448/http://www.seamframework.org/Weld/DependencyInjectionWishlist

          People

          • Assignee:
            Unassigned
            Reporter:
            pmuir Pete Muir
          • Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:

              Development