方法一.在TestDataSource .java测试
public class TestDataSource {
@SuppressWarnings("resource")
@Test
public void testDataSources() throws SQLException{
ApplicationContext ac = null;
{
ac = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
}
DataSource dataSource=ac.getBean(DataSource.class);
System.out.println(dataSource.getConnection());
}
}