title: using @Produces and @Inject across AS7 module dependencies
body: <p>is it possible to use a CDI producer method defined in module A in order to CDI inject into a bean in a second module B?</p>
  
  <p>Is there any description on the relation between CDI and the JBoss Modules System?</p>
  
  <p>In producer.jar:</p>
  
  <pre><code>import javax.enterprise.inject.Produces;
  import javax.enterprise.inject.spi.InjectionPoint;
  import java.util.logging.Logger;
  
  public class Producer {
  
      @Produces
      public static Logger produceLog(InjectionPoint injectionPoint) {
          return     Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
      }
  }
  </code></pre>
  
  <p>In consumer.war:</p>
  
  <pre><code>import javax.inject.Inject;
  import java.util.logging.Logger;
  
  
  public class Consumer {
      @Inject
      Logger logger;
  
      public void doLog() {
          logger.info("Hello CDI with JBoss Modules");
      }
  }
  </code></pre>
  
  <p>module B has a Manifest Dependency on module A:</p>
  
  <pre><code>Manifest-Version: 1.0
  Dependencies: deployment.producer.jar
  </code></pre>
  
  <p>this approach leads to an weld unsatisfied dependency problem:</p>
  
  <pre><code>"JBAS014671: Failed services" =&gt; {"jboss.deployment.unit.\"consumer.war\".WeldService" =&gt; "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"consumer.war\".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Logger] with qualifiers [@Default] at injection point [[field] @Inject question.Consumer.logger]"
  </code></pre>
  
  <p>I posted a sample project on Github: <a href="https://github.com/sistar/jboss-cdi-demo" rel="nofollow">https://github.com/sistar/jboss-cdi-demo</a></p>
  
  <p>TIA
  Ralf</p>