2 Replies Latest reply on May 19, 2009 1:37 AM by gavin.king

    specifying scope on injection point

    mikewse

      To be able to control scope on an individual injection point, is the preferred (and only?) solution to make a producer method for every anticipated scope? F ex:



      class MyBean {
           @Produces @ApplicationScoped @Binding1
           static public MyBean create1() {
                return new MyBean();
           }
      
           @Produces @RequestScoped @Binding2
           static public MyBean create2() {
                return new MyBean();
           }
      
           ...
      }
      
      class OtherClass {
           @Binding2
           MyBean bean; // = request scope
      }