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

Resources injected to producer fields fail to be produced

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 1.1.0.CR3
    • None
    • None
    • Hide

      The following class fails to deploy on JBoss AS 6.

      import javax.annotation.Resource;
      import javax.enterprise.context.ApplicationScoped;
      import javax.enterprise.inject.Produces;
      import javax.inject.Named;
      import org.infinispan.manager.EmbeddedCacheManager;

      /**
      *

      • @author johnament
        */
        public class CacheManagerProducer {
        @Produces @ApplicationScoped @Named("appCache")
        @Resource(name="CacheManager/entity")
        EmbeddedCacheManager ecm;

      //@Produces @ApplicationScoped @Named("appCache")
      public EmbeddedCacheManager getEmbeddedCacheManager()

      { return ecm; }

      }

      If you swap the commented producer line it does work. It appears that @Resource injection is not happening at the correct time. Same if you make it @Stateless.

      Show
      The following class fails to deploy on JBoss AS 6. import javax.annotation.Resource; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Produces; import javax.inject.Named; import org.infinispan.manager.EmbeddedCacheManager; /** * @author johnament */ public class CacheManagerProducer { @Produces @ApplicationScoped @Named("appCache") @Resource(name="CacheManager/entity") EmbeddedCacheManager ecm; //@Produces @ApplicationScoped @Named("appCache") public EmbeddedCacheManager getEmbeddedCacheManager() { return ecm; } } If you swap the commented producer line it does work. It appears that @Resource injection is not happening at the correct time. Same if you make it @Stateless.
    • Hide

      Use method level producers for resources.

      Show
      Use method level producers for resources.

    Description

      When you inject a resource in to a bean (session, managed, cdi, etc), the producer field that can be bound to it fails to deploy, at least under AS 6.

      Attachments

        Activity

          People

            pmuiratbleepbleep Pete Muir (Inactive)
            meetoblivion_jira John Ament (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: