i created two maven profile cause i want to deploy my app to heroku, so i have one profile dev with db properties that located on my PC, and prod with properties for heroku db. POM.xml below
<modelVersion>4.0.0</modelVersion>
<groupId>com.phone-book</groupId>
<artifactId>phone-book</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>controller</module>
<module>dao</module>
<module>model</module>
<module>service</module>
</modules>
<name>Phonebook web app</name>
<build>
<filters>
<filter>profiles/${build.profile.id}/config.properties </filter>
</filters>
<resources>
<resource>
<filtering>true</filtering>
<directory>controller/src/main/webapp/WEB-INF/spring</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals><goal>copy</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>8.0.30.2</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>prod</id>
<properties>
<build.profile.id>prod</build.profile.id>
</properties>
</profile>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<build.profile.id>dev</build.profile.id>
</properties>
</profile>
</profiles>
i created folder in each maven module profile that contains folders dev and prod and wrote my prop like in this tutorials https://www.petrikainulainen.net/programming/tips-and-tricks/creating-profile-specific-configuration-files-with-maven/ Finaly create spring context with this param, see below
<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="${url.property}" />
<property name="username" value="${user.property}" />
<property name="password" value="${password.property}" />
<property name="initialSize" value="20" />
<property name="maxActive" value="100"/>
</bean>
but when i make my app, properties does not replace and i get something like that
Cannot create JDBC driver of class 'org.postgresql.Driver' for connect URL '${url.property}'
<beans profile="dev/prod">
in your beans xml files definition? – Barbecue