ServiceLoader<BeanManagerProvider> loader = ServiceLoader
.load(BeanManagerProvider.class);
Iterator<BeanManagerProvider> it = loader.iterator();
while (mgr == null && it.hasNext()) {
BeanManagerProvider provider = it.next();
mgr = provider.getBeanManager();
}
}
return mgr;
}