title: dependency injection (CDI) in java EE 8
body: <p>I ve been looking into CDI to simplify the code, and I ve been trying to use it with Java EE 8. I an trying to replicate an existing exemple without success. I was wondering if anyone might have experienced the same issue:</p>
  
  <p><strong>The PoolManager Class:</strong></p>
  
  <pre><code>import javax.ejb.Startup;
  import javax.ejb.Singleton;
  import javax.annotation.PostConstruct;
  
  @Singleton
  @Startup
  public class PoolManager {
  
      private Queue&lt;Object&gt; pooledObjects;
  
      @PostConstruct
      private void init() {
          System.out.println("Hi");
          pooledObjects = new LinkedBlockingQueue&lt;Object&gt;(1_000);
          for (int i = 0; i &lt;= 1000; i++) {
              pooledObjects.offer(i);
          }   
      }
  
  
      public void returnObject(Object o) {
          pooledObjects.offer(o);
      }
  
      public Object borrowObject() {
          return pooledObjects.poll();
      }
  }
  </code></pre>
  
  <p>the UsePoolManager Class:</p>
  
  <pre><code>public class UsePoolManager {
  
      @Inject 
      private PoolManager poolManager;
  
      public void usePooledObject() {
          Object object = this.poolManager.borrowObject();
          System.out.println(object);
      }
  
  }
  </code></pre>
  
  <p>and the Main:</p>
  
  <pre><code>public static void main(String[] args) {
  
          UsePoolManager user = new UsePoolManager();
          user.usePooledObject();
      }
  }
  </code></pre>
  
  <p>The injection doesn t seem to be working at all at runtime. I have no beans xml (i understand it is not necessary, and adding it didnt change anything.). </p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p>Checking whether I am using SE or EE for clarification...</p>