AbstractApplication app = getApplicationUnchecked();
if(app!=null) {
ManagedBeanFactory[] factories = app.getManagedBeanFactories();
if(factories!=null && factories.length>0) {
for(int i=0; i<factories.length; i++) {
BeanFactory factory = factories[i].getBeanFactory(beanName);
if(factory!=null) {
Map<String,Object> map = getScope(factory.getScope());
synchronized(map) {
Object o = map.get(beanName);
if(o==null) {
o = factory.create(getClassLoader());
if(o!=null) {
map.put(beanName, o);
}
}
return o;