在需要测试的类上右键--new-JUnitTestCase,将包改为测试包
@Test
public void test() {
//1.从spring容器中获取Dao
ApplicationContext app = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
CustomerDao cd = (CustomerDao) app.getBean("customerDao");
Customer c = cd.findById(23L);
System.out.println("*****"+c.getCustName());
}