if (matching.size() == 1) {
return matching.iterator().next();
}
else if (matching.isEmpty()) {
throw new IOCResolutionException("no matching bean instances for: " + type.getName());
}
else {
throw new IOCResolutionException("multiple matching bean instances for: "
+ type.getName() + " matches: " + matching);
}
}