Mybatis Spring

ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
CustomerService userService = (CustomerService) ac.getBean("customerService");
Customer cust = userService.queryByCertId("371424192308073611");
// Userinfo userinfo = user.geUserinfoByid(1);
if(cust != null){
    System.out.println(cust.getCustomerName());
}




默认单例 , 多例 
@Scope("prototype")

你可能感兴趣的:(mybatis)