I have a Java/Spring web app that I want to deploy to a remote server, possibly an Amazon ec2 instance.
The app uses a MySQL database, and to keep the data configuration distinct I have the database parameters stored in a separate ‘environ.properties’, like…
database.url=jdbc:mysql://localhost:3306/berthier
database.uid=root
database.pwd=root
This environ.properties file is then referenced in the Spring applicationcontext.xml file, like…
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:environ.properties</value>
</property>
</bean>
<bean id="SQLData"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="${database.url}">
</property>
<property name="username" value="${database.uid}"></property>
<property name="password" value="${database.pwd}"></property>
</bean>
Yet , how do make this approach work for a remote server? With ec2 I don’t even know the address until the instance starts. Any ideas?