This content has been marked as final.
Show 1 reply
-
1. Re: Getting all components implementing a given interface
swd847 Feb 17, 2009 11:31 PM (in response to wark2007)This is how I do it (I really look for annotations but the principle is the same):
@Name("customSetupInstaller") @Scope(ScopeType.APPLICATION) @Startup public class CustomSetupInstaller { @Create public void handleItems() { String[] names = Contexts.getApplicationContext().getNames(); for (String i : names) { if (i.endsWith(".component")) { Component c = (Component) Contexts.getApplicationContext().get( i); Class e = c.getBeanClass(); if(MyInterface.class.isAssignableFrom(e)) { //do stuff } } } } }