Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-1960

CDI @Inject of @Stateless @WebService cause WELD-001408 Unsatisfied dependencies

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 8.0.0.Alpha4
    • CDI / Weld, EJB, Web Services
    • None

      CDI @Inject of @WebService does not work.

      import javax.ejb.Stateless;
      import javax.jws.WebService;
       
      @Stateless
      @WebService
      public class TestBean {
      }
       
       
      import javax.inject.Inject;
       
      import org.jboss.arquillian.container.test.api.Deployment;
      import org.jboss.arquillian.junit.Arquillian;
      import org.jboss.shrinkwrap.api.ShrinkWrap;
      import org.jboss.shrinkwrap.api.asset.EmptyAsset;
      import org.jboss.shrinkwrap.api.spec.WebArchive;
      import org.junit.Test;
      import org.junit.runner.RunWith;
       
       
      @RunWith(Arquillian.class)
      public class TestBeanIT {
       
          @Inject
          TestBean bean;
       
          @Deployment
          public static WebArchive createDeployment() {
              WebArchive arch =  ShrinkWrap.create(WebArchive.class);
              arch.addClass(TestBean.class);
              arch.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
              return arch;
          }
       
          @Test
          public void fooTest() throws Exception {
       
          }
      }
      

      Using CDI to do a non contextual injection on a class where @EJB is used instead of @Inject works.

      @RunWith(Arquillian.class)
      public class TestBeanIT {
       
          @EJB
          TestBean bean;
          ...
      }
      

              mkouba@redhat.com Martin Kouba
              aslak@redhat.com Aslak Knutsen
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: