dimanche 28 juin 2015

context:property-placeholder not working if we use property file under src/test

I'm using the property file to configure the datasource in spring :

<bean id="mydataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close">
        <property name="driverClass" value="${database.driver}" />
        <property name="jdbcUrl" value="${database.url}" />
        <property name="user" value="${database.username}" />
        <property name="password" value="${database.password}" />
         <property name="initialPoolSize" value="${database.initialpoolsize}" 
            />
         <property name="minPoolSize" value="${database.minpoolsize}" /> 
         <property name="maxPoolSize" value="${database.maxpoolsize}" /> 

    </bean>

Here is the configuration of this file in spring

<context:property-placeholder location="classpath*:database.properties" />

This property file is under src/test/config/ folder , when I run the test it gives me this error:

java.lang.IllegalArgumentException: Could not resolve placeholder 'database.driver' in string value "${database.driver}"

Could someone help me on that?

Aucun commentaire:

Enregistrer un commentaire