Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2563

In a CDI SE application, three instances of every Service loaded are created; only one is used

    Details

      Description

      (See this forum message for details.)

      I have a CDI SE application (flat classpath). I have a JpaInjectionServices implementation with a corresponding META-INF/services entry.

      I notice that it is instantiated three times by Weld, but only the first instance is used.

      I believe this is because the code in AdditionalServiceLoader loads the service using three distinct ResourceLoaders: the single ClasspathResourceLoader used by the Deployment, the WeldClasspathResourceLoader used always when loading additional services, and the DefaultResourceLoader used always when loading additional services.

      At the very least it seems that there should be some documentation that indicates that a Service will be instantiated in a CDI SE application a minimum of three times, and only the first of those three instances will be used.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mkouba Martin Kouba
                Reporter:
                ljnelson Laird Nelson
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: