You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rusty Wright <ru...@gmail.com> on 2008/10/14 19:21:34 UTC

maven rewriting resources question

With Spring the typical setup would be to have properties files, like the following jdbc.properties file (from the appfuse example):

    jdbc.driverClassName=${jdbc.driverClassName}
    jdbc.url=${jdbc.url}
    jdbc.username=${jdbc.username}
    jdbc.password=${jdbc.password}

Then in your applicationContext.xml refer to those properties with ${} place holders and Spring's PropertyPlaceholderConfigurer will do the ${} substitutions:

    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:jdbc.properties</value>
            </list>
        </property>
    </bean>

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

Before I started using Maven my jdbc.properties files had the final values, no ${} place holders.  But now with Maven the final values are in the profiles.xml file in a properties section in profiles.  It seems to me that since the applicationContext.xml file is in the resources folder that Maven can rewrite it just as well as it can the jdbc.properties file so I tossed my jdbc.properties file.

Is there any advantage to keeping the jdbc.properties file with its ${} place holders?  It just seems to me to be an extra and unnecessary layer.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org