【发布时间】:2019-07-01 05:33:24
【问题描述】:
这是我的 ApplicationContext.xml 代码
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
<property name="driverClassName" value="${database.driverClassName}" />
<property name="url" value="${database.url}" />
<property name="username" value="${database.username}" />
<property name="password" value="${database.password}" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="1800000" />
<property name="numTestsPerEvictionRun" value="3" />
<property name="minEvictableIdleTimeMillis" value="1800000" />
</bean>
我的属性在一个名为 database.properties
的文件中定义我需要在 父 pom.xml 中进行哪些更改才能在 目标运行时
转换 env 变量能否请您帮忙或给我一个适当的建议或链接,让我在运行时获得数据库属性的名称。
例如
database.driverName 应更新为 jdbcDriver
【问题讨论】:
标签: spring hibernate datasource applicationcontext