user=LF
password=LF
url=jdbc:oracle:thin:@localhost:1521:orcl
driver=oracle.jdbc.driver.OracleDriver
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd"> <context:property-placeholder location="classpath:jdbc.properties"/>
<bean id="connection" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="username" value="${user}"></property>
<property name="password" value="${password}"></property>
<property name="driverClassName" value="${driver}"></property>
<property name="url" value="${url}"></property>
</bean> </beans>
public class Utils_jdbc {

    public static void main(String[] args) {

        ApplicationContext ctc = new ClassPathXmlApplicationContext("applicationContext.xml");

        DriverManagerDataSource dSource = (DriverManagerDataSource) ctc.getBean("connection");

        try {

            System.out.println(dSource.getConnection());
} catch (SQLException e) {
e.printStackTrace();
} } }

最新文章

  1. Fedora 22中的Services and Daemons
  2. COGS182 [USACO Jan07] 均衡队形[RMQ]
  3. 图解jmeter压测http接口
  4. .NET跨平台之mac 下vs code 多层架构编程
  5. 4. Prototype(原型)
  6. DevExpress Ribbongallerybaritem选择性皮肤重组
  7. Bubble Sort [ASM-MIPS]
  8. Wdcp在安装memcached出现错误的解决办法
  9. java最全的验证类封装
  10. Php output buffering缓存及程序缓存
  11. 20145120 《Java程序设计》第7周学习总结
  12. 跟大家分享下今天所学到的PHP,虽然很基础,但是感觉也很重要
  13. DOM生成XML文档与解析XML文档(JUNIT测试)
  14. NSURLConnection请求时间
  15. Tomcat 7.0 进入项目管理页面时的密码问题
  16. Jquery文本框值改变事件(支持火狐、ie)
  17. 腾讯云实力通过工信部测评,获全国范围CDN经营许可
  18. element-ui,router.push到其他路由,菜单栏不会高亮对应的路由
  19. 最小化安装CentOS7的网卡设置
  20. MySQL使用select查询时,在查询结果中增加一个字段并指定固定值

热门文章

  1. &quot;==&quot; 与 &quot;is&quot;的区别
  2. Dreamweaver_CS6安装与破解
  3. C#编程的几个建议
  4. ES6常用知识总结(20%的知识占80%的份额)
  5. 冒泡排序的JavaScript实现
  6. 新机器连接老机器遇到的ERROR
  7. centOS下 JDK的三种安装方式
  8. Annotation之二:@Inherited注解继承情况
  9. Git使用点滴记录: You have no permission to access this repo.
  10. 1139 First Contact