0 Replies Latest reply on Jul 6, 2014 6:34 AM by ericjvandervelden

    How to let a scoped producer method to produce a primitive int?

    ericjvandervelden

      I have the random number generator from the documentation,

       

      public class RandomNumberGenerator{

              private java.util.Random random=new java.util.Random(System.currentTimeMillis());

              @Produces @Random @SessionScoped

              int getRandomNumber(){

                      return random.nextInt(100);

              }

      }

       

      As you can see, I want the producer method being session scoped.  But then I get an error message, because the method produces a primitive int,

       

      org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001410 The injection point [parameter 1] of [method] @Produces @Named @MyQ @RequestScoped public org.jboss.as.quickstarts.greeter.MyGenerator.getMy(int) has non-proxyable dependencies

       

      This is the injection point,

       

             @Produces @Named @MyQ

              public My getMy(@Random int randomNumber){

                  ...