for (String key : keys) {
final String registrationKey = contributions.get(key);
final Object bean = beanFactory.getBean(key);
if (bean != null) {
try {
registry.addItem(registrationKey, bean);
} catch (ClassCastException e) {
throw new ConfigurationException("Bean '" + key + "' is not type compatible with " +
"registry bean '" + registryBeanName + "'");
}
}