sping

模拟实现:Bean对象获取

点击查看代码
public class MyBean{
  id
  clazz
}

public interface BeanFactory{
  getBean(id)
}
ClassPathXmlApplication implement BeanFactory{
  list<MyBean> beans;
  map<String ,Object> maps;
  public ClassPathXmlApplication(filePathName){
  
  parseXml()
  instanceBeans()
}
@Override
public Object getBean(id){
  return maps.get(id)
}
}
posted @ 2021-12-24 15:45  丁同亚的博客  阅读(268)  评论(0编辑  收藏  举报