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

StackOverflowException from circular injection

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.1.1.Final, 2.2.0.Alpha1
    • 2.0.4.Final, 2.1.0.Beta2
    • None
    • None
    • Hide

      @ApplicationScoped
      public class CdiTest {

      public static void main(String[] args)

      { Weld weld = new Weld(); WeldContainer container = weld.initialize(); CdiTest test = container.instance().select(CdiTest.class).get(); test.test(); }

      public void test() {

      }

      @Produces
      private ABeanToBeMocked aMockedBean = new ABeanToBeMocked(2);

      @Inject
      private ABeanToBeInjected aBeanToBeInjected;

      public static class AProducer {

      @Inject
      private ABeanToBeMocked aMockedBean;

      @Produces
      public ABean namedBean()

      { return new ABean(2); }

      }

      public static class ABeanToBeMocked {
      ABeanToBeMocked(int foo) {

      }
      }

      public static class ABeanToBeInjected

      { @Inject ABean namedBean; }

      public static class ABean {
      ABean(int foo) {

      }
      }
      }

      Show
      @ApplicationScoped public class CdiTest { public static void main(String[] args) { Weld weld = new Weld(); WeldContainer container = weld.initialize(); CdiTest test = container.instance().select(CdiTest.class).get(); test.test(); } public void test() { } @Produces private ABeanToBeMocked aMockedBean = new ABeanToBeMocked(2); @Inject private ABeanToBeInjected aBeanToBeInjected; public static class AProducer { @Inject private ABeanToBeMocked aMockedBean; @Produces public ABean namedBean() { return new ABean(2); } } public static class ABeanToBeMocked { ABeanToBeMocked(int foo) { } } public static class ABeanToBeInjected { @Inject ABean namedBean; } public static class ABean { ABean(int foo) { } } }

    Description

      When using Weld-SE a StackOverflowException is generated from running the following code.

      Attachments

        Activity

          People

            mkouba@redhat.com Martin Kouba
            bryncooke Bryn Cooke (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: