spring全家桶的配置格式

Spring的xml配置格式



        
        
        
       
      

Spring的工厂创建格式

public class test_car {
public static void main(String[] args) {
	    ApplicationContext applicationContext=new ClassPathXmlApplicationContext("applicationContext.xml");
		car car1=   (car) applicationContext.getBean("car");
        car1.run();
	}
}

Mybatis的配置文件sql_config.xml




 
 
 
 
                
                
                
                
 
 
 




Mybatis的mapper的sql_mapper.xml






Mybatis的sqlSession工厂创建格式

public class test_bird {
    
	@Test
	public void ceshi() throws IOException {
		SqlSessionFactoryBuilder ss=new SqlSessionFactoryBuilder();
		InputStream inputStream=Resources.getResourceAsStream("sql_config.xml");
		SqlSessionFactory fa=ss.build(inputStream);
		SqlSession pi=fa.openSession();
		bird oi=pi.selectOne("getcolor", 1);
		System.out.println(oi);
	    pi.close();
	}
}

你可能感兴趣的:(java)