I am currently dealing with the deployment of my web-server which is why I am facing a presumably very common problem: Configuration files
As a very straight forward example let's take a database. I have a local database.xml
which contains the data source which I use on my local machine:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:5432/mz_db" />
<property name="username" value="postgres" />
<property name="password" value="pg" />
</bean>
but of course, I am connecting to a different database once I deploy the server. So what are my options here? I would like to have this as centralized as possible to prevent wrong files being deployed here. I am sure that maven can be used for this somehow.
I was thinking about doing something like creating two config/
directories
WEB-INF/config/
WEB-INF/config-dev/
and use config-dev/
per default without the exception of the deploy
phase or something like this. I am not sure if this can be done or if this is the best way of doing it.
Any suggestions?