Spring使用配置文件读取jdbc.properties

2014-11-24 07:51:07 · 作者: · 浏览: 1

在beans.xml中加入两个必须的bean

[html]
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">






destroy-method="close">





在web-inf下面的jdbc.properties

[html]
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://210.30.12.3:3306/spring
jdbc.username=root
jdbc.password=sa


摘自 chengchanglun的专栏