Использование свойств Maven settings.xml в контексте Spring

У меня есть Mavensettings.xml файл в моем~/.m2 каталог; это выглядит так:

<settings>
    <profiles>
        <profile>
            <id>mike</id>
            <properties>
                <db.driver>org.postgresql.Driver</db.driver>
                <db.type>postgresql</db.type>
                <db.host>localhost</db.host>
                <db.port>5432</db.port>
                <db.url>jdbc:${db.type}://${db.host}:${db.port}/dbname</db.url>
            </properties>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>mike</activeProfile>
    </activeProfiles>
    <servers>
        <server>
            <id>server_id</id>
            <username>mike</username>
            <password>{some_encrypted_password}</password>
        </server>
    </servers>
</settings>

Я хотел бы использовать эти свойства дважды

Once inside Maven's integration-test phase to set up and tear down my database. Using Maven filtering, this is working perfectly. A second time when running my Spring application, which means I need to substitute these properties into my servlet-context.xml file during Maven's resources:resources phase. For properties in the upper section of settings.xml, such as ${db.url}, this works fine. I cannot figure out how to substitute my database username and (decrypted) password into the Spring servlet-context.xml file.

Соответствующая часть моегоservlet-context.xml файл выглядит так:

<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName"><value>${db.driver}</value></property>
    <property name="url"><value>${db.url}</value></property>
    <property name="username"><value>${username}</value></property>
    <property name="password"><value>${password}</value></property>
</bean>

Конечная цель для каждого разработчика - иметь собственные настройки Maven (и базу данных на своем компьютере для тестирования интеграции) ... И аналогичную настройку на сервере Jenkins. Мы не хотим использовать общее имя пользователя / пароль / и т. Д.

Ответы на вопрос(3)

Ваш ответ на вопрос