首页>代码>Spring容器解析applicationContext.xml,提供bean的三种实例化用法(直接调用,静态工厂,实例工厂)>/源码-Spring容器(bean容器)通过解析applicationContext.xml,提供bean的三种用法(直接调用,静态工厂,实例工厂)/staticFactory/Test.java
                
                package ioc.createBean.staticFactory;
import module.dao.UserDao;
import module.model.User;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Test {
	public static void test() {
		String xmlPath = "/ioc/createBean/staticFactory/bean_staticFactory.xml";
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( xmlPath);
		UserDao userDao = (UserDao) context.getBean("userDao");
		System.out.println(userDao);
		userDao.saveUser(new User());
	}
	public static void main(String[] args) {
		test();
	}
}
最近下载更多
                
                lichangliu1098     LV12
                2018年4月22日
            
            
        
                朝鲜飞行员     LV7
                2018年3月16日
            
            
        
                zhengmingzhao     LV1
                2016年9月13日
            
            
        
                chenxh     LV1
                2016年9月9日
            
            
        
                panxia     LV5
                2016年8月30日
            
            
        
最近浏览更多
                
                2636804923     LV6
                2024年6月16日
            
            
        
                aqin_qin     LV1
                2022年6月5日
            
            
        
                jimshao289015254     LV9
                2021年12月31日
            
            
        
                水光浮藻     LV6
                2021年3月25日
            
            
        
                jeep123456     LV10
                2021年3月17日
            
            
        
                sanqijiang     LV3
                2020年10月25日
            
            
        
                13043860zj     LV16
                2020年9月3日
            
            
        
                fate02    
                2020年6月4日
            
            
                    暂无贡献等级
            
        
                付洋麟     LV5
                2020年5月15日
            
            
        
                sweetyy     LV8
                2020年4月2日
            
            
        
                
                
    