addBeanProvider should defer autoSetupBeans after adding all beans instead of trying to setup them right away.

Description

then using the new function addBeanProvider we have the possibility to autosetup beans but it won't work since when starting adding new beans, we might require a bean that hasn't been added yet to the collection.

Imagine adding ModuleA beans to MainApp. Using mainApp.beanFactory.addBeanProvider( moduleA.beanProviders[0] ,true ), we might have moduleA beans depending on each other, but since it will append them and directly setup them, it will fail to resolve dependencies because not all are present yet.

addBeanProvider should be something like

for each( var bean:Bean in beanProvider.beans )
{
addBean( bean , false) ;
}
if(autoSetupBeans)
{
for each( var bean:Bean in beanProvider.beans )
{
setUpBean( bean );
}
}

Environment

None

Status

Assignee

Ben Clinkinbeard

Reporter

João Fernandes

Labels

None

Fix versions

Affects versions

Priority

Major
Configure