Object newbean; if (rbi.factorybean != null) { Object factorybean = getBean(pri, rbi.factorybean); newbean = ReflectiveCache.invokeMethod(factorybean, rbi.factorymethod); rbi.beanclass = newbean.getClass(); } else {
  private Object createBean(PerRequestInfo pri, String beanname) {    RSACBeanInfo rbi = (RSACBeanInfo) rbimap.get(beanname);    // Locate the "dead" bean from the genuine Spring context, and clone it    // as quick as we can - bytecodes might do faster but in the meantime    // observe that a clone typically costs 1.6 reflective calls so in general    // this method will win over a reflective solution.    // NB - all Copiables simply copy dependencies manually for now, no cost.    // Copiable deadbean = (Copiable) livecontext.getBean(rbi.isfactorybean? "&"    // +beanname : beanname);    // All the same, the following line will cost us close to 1us - unless it    // invokes manual code!    Object newbean = ReflectiveCache.construct(rbi.beanclass);    MethodAnalyser ma = MethodAnalyser.getMethodAnalyser(rbi.beanclass, smc);    // Object clonebean = deadbean.copy();    // iterate over each LOCAL dependency of the bean with given name.    for (Iterator depit = rbi.dependencies(); depit.hasNext();) {      String propertyname = (String) depit.next();      Object depbean = null;      Object beanref = rbi.beannames(propertyname);      if (beanref instanceof String) {        depbean = getBean(pri, (String) beanref);      }      else {        ArrayList beanlist = new ArrayList();        StringList beannames = (StringList) beanref;        for (int i = 0; i < beannames.size(); ++i) {          String thisbeanname = beannames.stringAt(i);          Object bean = getBean(pri, thisbeanname);          beanlist.add(bean);        }        depbean = beanlist;      }      AccessMethod setter = ma.getAccessMethod(propertyname);      // Deliver the dependent bean as member. This will at this point      // OVERWRITE the "dead" bean inherited from the cloned parent.      // Lose another 500ns here, until we bring on FastClass.      setter.setChildObject(newbean, depbean);    }    // process it FIRST since it will be the factory that is expecting the    // dependencies    // set!    processNewBean(pri, beanname, newbean);    if (newbean instanceof FactoryBean) {      FactoryBean factorybean = (FactoryBean) newbean;      try {        newbean = factorybean.getObject();      }      catch (Exception e) {        throw UniversalRuntimeException.accumulate(e);      }    }    // enter the bean into the req-specific map.    pri.beans.put(beanname, newbean);    if (rbi.initmethod != null) {      ReflectiveCache.invokeMethod(newbean, rbi.initmethod);    }    if (rbi.destroymethod != null) {      pri.todestroy.add(beanname);    }    return newbean;  }