java - CDI @Inject Instance @Any - But instance never populated with instances -


why 'instance' never iterate on implementations? missing?

jboss eap 6.3.0.ga (as 7.4.0.final-redhat-19)

public interface simple { } public class simplea implements simple { public simplea() { } } public class simpleb implements simple { public simpleb() { } } public class simpleuser {     @inject @any instance<simple> instance;      @postconstruct public void init() {         (final simple simple : instance) {             system.out.println(simple);         }     } } 

in case helps else, using deltaspike 1.5.2 , running same issue (if remove deltaspike, no longer have problem).

in case adding producer methods did not solve it. after looking around beanprovider gets around problem far elegant.

https://deltaspike.apache.org/documentation/core.html#beanprovider

i had call

list<myserviceinterface> myservicelist = beanprovider.getcontextualreferences(myserviceinterface.class, false, false);

there better ways. notice deltaspike turns on bunch of extensions default, couldn't find docs on how disable ones not using suspect 1 may causing issue.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -