// If there's already an instance of this bean, notify observers of it's
// removal (removal by being overwritten)...
Object currentInstance = getBean(beanId);
if (currentInstance != null) {
notifyObservers(new BeanContextLifecycleEvent(executionContext,
source, BeanLifecycle.REMOVE, beanId, currentInstance));
}
// Check if the BeanIdList has new BeanIds and if so then
// add those new entries to the Map. This ensures we always
// have an up to date Map.
checkUpdatedBeanIdList();
int index = beanId.getIndex();
ContextEntry repoEntry = entries.get(index);
clean(index);
repoEntry.setValue(bean);
// Add the bean to the context...
notifyObservers(new BeanContextLifecycleEvent(executionContext, source,
BeanLifecycle.ADD, beanId, bean));
}