### Question:
BeanFactory { public Object getBean(String beanId) { Object obj = null; for (BeanDefined beanDefined : beanDefineds) { if (beanDefined.getBeanId().equals(beanId)) { String classPath = beanDefined.getClassPath(); try { Class classFile = Class.forName(classPath); obj = classFile.newInstance(); return obj; } catch (ClassNotFoundException e) { System.err.println("当前类文件不存在"); e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } } return obj; } BeanFactory(List<BeanDefined> beanDefineds); Object getBean(String beanId); Object getBeanScope(String beanId); Object getBeanFactory(String beanId);  }### Answer:
@Test public void beanTest01() { BeanDefined beanDefined = new BeanDefined(); beanDefined.setBeanId("teacher"); beanDefined.setClassPath("com.huifer.bean.Teacher"); List<BeanDefined> beanDefinedList = new ArrayList<BeanDefined>(); beanDefinedList.add(beanDefined); BeanFactory beanFactory = new BeanFactory(); beanFactory.setBeanDefineds(beanDefinedList); Teacher teacher = (Teacher) beanFactory.getBean("teacher"); System.out.println(); }