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

Bogus circular injection warning

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.2.0.Beta2
    • 2.1.2.Final
    • None
    • None

      In my project, I have a class EntityManagerProducer. I have another class InitializerConfig that injects an EntityManager, which comes from a producer method in EntityManagerProducer.

      EntityManagerProducer has no injections. And yet, if InitializerConfig is dependent-scoped, I get this warning:

      15:16:47,079 WARN  [org.jboss.weld.Bean] (main) WELD-000018: Executing producer field or method [BackedAnnotatedMethod] @Produces com.sgi.song.gp.database.EntityManagerProducer.produceEntityManager() on incomplete declaring bean Managed Bean [class com.sgi.song.gp.database.EntityManagerProducer] with qualifiers [@Any @Default] due to circular injection
      

      If InitializerConfig is application-scoped instead, this warning does not appear. InitializerConfig has no other injections.

      I also have another application-scoped class ClusterSupportConfigurator that injects InitializerConfig (and nothing else). It produces a JChannel, and a different class injects @Any Instance<JChannel> and iterates over all produced JChannels. The iteration occurs twice: once during startup to connect all the JChannels, and again during shutdown (in a @PreDestroy method) to close all the JChannels. Again, I get a bogus circular injection warning, but curiously, this only happens during shutdown:

      15:27:13,239 WARN  [org.jboss.weld.Bean] (Thread-2) WELD-000018: Executing producer field or method [BackedAnnotatedField] @Produces @ClusterMessaging private com.sgi.song.gp.protocol.SONGv1.cluster.ClusterSupportConfigurator.channel on incomplete declaring bean Managed Bean [class com.sgi.song.gp.protocol.SONGv1.cluster.ClusterSupportConfigurator] with qualifiers [@Any @Default] due to circular injection
      

      In all cases, Weld doesn't provide any information to indicate what beans it thinks are part of this phantom cycle.

            rhn-engineering-jharting Jozef Hartinger
            rdicroce Richard DiCroce (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: