读书人

模拟Spring的读取xml资料及注入

发布时间: 2012-10-09 10:21:45 作者: rapoo

模拟Spring的读取xml文件及注入
简单的xml配置文件


BeanFactory接口


调用测试:
public SpringTest{      @Test    public void testAdd()    {        BeanFactory factory = new ClassPathXmlApplicationContext();        UserService service = (UserService) factory.getBean("userService");        User u = new User();        service.add(u);    }}

读书人网 >XML SOAP

热点推荐