try {
for (Method meth : beanMethods) {
T tmp = (T) meth.invoke(null);
if (tmp != null) {
if (ret != null) {
throw new ServiceLocatorException("More than one implementation found (primary=" + primary
+ ").");
}
ret = tmp;
}
}
} catch (Exception e) {
throw new ServiceLocatorException(e);
}
return ret;
}