Skip to content

Instantly share code, notes, and snippets.

@steveturner
Last active March 30, 2018 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveturner/8427d8407e97cf0a5233bb3ff19fab9c to your computer and use it in GitHub Desktop.
Save steveturner/8427d8407e97cf0a5233bb3ff19fab9c to your computer and use it in GitHub Desktop.
An example using CDI to provide multiple implementations of an interface.
@Inject
private Instance<IPropagationModel> providerSource;
public ProviderLister() {
}
public List<String> getProviderList() {
List<String> names = new ArrayList<String>();
for (IPropagationModel provider : providerSource) {
names.add(provider.getName());
}
return names;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment