저희는 아래와 같은 방법으로 관리하고 있습니다.
JAVA arguments에 -Dspring.profiles.active=dev 를 추가하여 각 환경을 구분합니다.
<!-- ============================================================= -->
<!-- properties -->
<!-- ============================================================= -->
<util:properties id="appConfig" location="classpath:config/${spring.profiles.active}-config.xml" />
<context:property-placeholder properties-ref="appConfig" />
<!-- ============================================================= -->
<!-- dataSource -->
<!-- ============================================================= -->
<beans profile="dev">
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="#{baseConfig['jdbc.driver']}" />
<property name="jdbcUrl" value="#{baseConfig['jdbc.url']}" />
<property name="user" value="#{baseConfig['jdbc.username']}" />
<property name="password" value="#{baseConfig['jdbc.password']}" />
<property name="acquireRetryAttempts" value="10" />
<property name="preferredTestQuery" value="SELECT 1;" />
<property name="testConnectionOnCheckin" value="true" />
<property name="testConnectionOnCheckout" value="false" />
<property name="maxIdleTime" value="300" />
<property name="idleConnectionTestPeriod" value="30" />
<property name="initialPoolSize" value="2" />
<property name="maxPoolSize" value="10" />
</bean>
</beans>
<beans profile="test">
<jdbc:embedded-database id="dataSource" type="HSQL">
<jdbc:script location="classpath:schema.sql"/>
</jdbc:embedded-database>
</beans>