Hello,
I am trying to inject a list of objects via @Produces. I have an App.java, which uses the WeldContainer to create an instance of UI. Then I run UI.start(), which creates an object of Lister by calling "new Lister()". Lister has a private Finder which is injected via @FooFinder qualifier. It has a getFoos() method which calls finder.getFoos(). Finder.getFoos() just returns it's private attribute fooList, which is injected by using an @Produces annotation. The @Produces public List<Foo> createFoos() is defined in FooCreator.java.
Underneath you'll find my code. You can see the whole project on my git repo:
https://github.com/cwansart/WeldProducesTest/tree/master/src/main/java/com/mycompany/weldproducestest
App.java
UI.java
Lister.java
Finder.java
FooFinder.java
FooCreator.java
Foo itself is just a small class where nothing happens.
When I call lister.getFoos() in the UI class it's null. Why is that so? When I just inject the fooList in my UI class, it works.