[webbeans-dev] Re: producer methods and injection

Benjamin Graf Benjamin.Graf at gmx.net
Thu Jan 1 14:10:30 EST 2009


I played a bit around this code fragment and everything works as
expected for me.

@Nik: Do you have a complete example and a bit more information to
verify your problem?

> No, @Dependent is the default.
>
> On Fri, Jan 2, 2009 at 12:22 AM, Benjamin Graf <Benjamin.Graf at gmx.net <https://lists.jboss.org/mailman/listinfo/webbeans-dev>> wrote:
> >/ I'm not sure but doesn't it need a @Dependent scope to work?
> />/
> />/ Gavin King wrote:
> />>/ That code should work. If it doesn't it would be a bug.
> />>/
> />>/ On Wed, Dec 31, 2008 at 9:38 PM, Nicklas Karlsson <nickarls at gmail.com <https://lists.jboss.org/mailman/listinfo/webbeans-dev>> wrote:
> />>/
> />>>/ Hi,
> />>>/
> />>>/ Is there something I don't understand about producers methods and
> />>>/ injection with parameterized types when I have
> />>>/
> />>>/ public class A
> />>>/ {
> />>>/   @Produces @Users
> />>>/   public List<User> getUsers() {
> />>>/      List<User> users = new ArrayList<User>();
> />>>/      users.add(new User("1", "1", "1"));
> />>>/      return users;
> />>>/   }
> />>>/ }
> />>>/
> />>>/ and
> />>>/
> />>>/ @SessionScoped
> />>>/ public class B
> />>>/ {
> />>>/   @Users
> />>>/   private List<User> users;
> />>>/
> />>>/   public int count() {
> />>>/      return users.size();
> />>>/   }
> />>>/ }
> />>>/
> />>>/ When B is created and injection is done, it goes looking for
> />>>/ java.util.List and fails.
> />>>/
> />>>/ ---
> />>>/ Nik
> />>>/
> />>>/
> />>/
> />>/
> />>/
> />>/
> />/
> />/ _______________________________________________
> />/ webbeans-dev mailing list
> />/ webbeans-dev at lists.jboss.org <https://lists.jboss.org/mailman/listinfo/webbeans-dev>
> />/ https://lists.jboss.org/mailman/listinfo/webbeans-dev
> />/
> /
>
>
> -- 
> Gavin King
> gavin.king at gmail.com <https://lists.jboss.org/mailman/listinfo/webbeans-dev>
> http://in.relation.to/Bloggers/Gavin
> http://hibernate.org
> http://seamframework.org
>   



More information about the weld-dev mailing list