title: Create parameterized objects at runtime with CDI
body: <p>The project is set up with CDI 2.0 (specifically Weld 3.0.4).
  Now I want to have a service accessing and caching an external REST interface.</p>
  
  <p>For the sake of simplicity let's assume this REST interface is returning Json objects for given numeric identifiers, speaking in Java: <code>service.getProduct(int productKey)</code>.</p>
  
  <p>What is the 'CDI way' to write such a service, specifically the scope and the instantiation of <code>Product</code> objects (which are returned by the service)?</p>
  
  <p>(Incomplete) Pseudo code:</p>
  
  <pre><code>public class ProductService {
      public Product getProduct(int productKey) {
          String json = rest.get(productKey);
          return new Product(json);
      }
  }
  
  ...
  
  @Produces
  public Product create(int productKey) {
      return new Product(productKey);
  }
  </code></pre>
  
  <p>From my research producer methods do not support runtime parameters. So how to bring these two parts together?</p>