获取spring applicationcontext数据连接connection
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); // DataSource dataSource = (DataSource) context.getBean("dataSource"); // ApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"applicationContext.xml"}); DataSource dataSource =(DataSource) context.getBean("dataSource"); Connection conn = (Connection) dataSource.getConnection();
--------------------------------------------------------------------------------------------------------------------------------------------
作者:Honey_Badger —— 觉得这文章好,点一下左下角
出处:http://tk55.cnblogs.com/
posted on 2017-09-11 16:51 Honey_Badger 阅读(465) 评论(0) 编辑 收藏 举报