下面是db.properties内容:
db.url = jdbc:mysql://localhost:3306/xxxxx
createDatabaseIfNotExist=true
db.username = xxx
db.password = xxx
db.driverClassName = com.mysql.jdbc.Driver
hibernate.show_sql = true
hibernate.dialect = org.hibernate.dialect.MySQLInnoDBDialect
hibernate.hbm2ddl.auto = update
应用的时候, 在命名空间上配置上spring-context-3.0.xsd ;
然后在spring的配置(application.xml)文件中, 加入
<context:property-placeholder location="classpath:db.properties"/>
用到db.properties里面属性的时候,只要
<property name="username" value="${db.username}" />