zoukankan      html  css  js  c++  java
  • spring jdbc.property的配置与使用

    jdbc.properties

    driver=com.mysql.jdbc.Driver
    url=jdbc:mysql://127.0.0.1:3306/ssi1
    username=root
    password=root
    

     在 applicationContext.xml 中增加如下代码

    <bean id="propertyConfigurer"
    		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    		<property name="locations">
    			<list>
    				<value>classpath:jdbc.properties </value>
    			</list>
    		</property>
    	</bean>
       	
    	<bean id="dataSource"
    		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    		<property name="driverClassName">
    			<value>${driver}</value>
    		</property>
    		<property name="url">
    			<value>${url}</value>
    		</property>
    		<property name="username">
    			<value>${username}</value>
    		</property>
    		<property name="password">
    			<value>${password}</value>
    		</property>
    	</bean>
    

     注意:jdbc.properties文件放在src下

  • 相关阅读:
    Python之函数进阶
    Python之函数初识
    Python之 文件操作
    数据类型补充
    Python 基础三
    寒假学习第五天
    寒假学习第四天
    寒假学习第三天
    寒假学习第二天
    寒假学习第一天
  • 原文地址:https://www.cnblogs.com/liuyq/p/3687280.html
Copyright © 2011-2022 走看看