2 Replies Latest reply on May 19, 2009 1:37 AM by Gavin King

    specifying scope on injection point

    Mike Wilson Newbie

      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
      }