PropertyPlaceholderConfigurer works from Maven command line, but not from Eclipse?

Posted by HDave on Stack Overflow See other posts from Stack Overflow or by HDave
Published on 2010-06-10T05:05:14Z Indexed on 2010/06/10 5:13 UTC
Read the original article Hit count: 179

Filed under:
|
|
|
|

I have Eclipse configured to use an external maven instance. Nonetheless I have an integration test that runs fine from the command line, but fails from within Eclipse. The error is a class Spring application context bean error:

Cannot convert value of type [java.lang.String] to required type

The culprit it a bean that sets property values using a PropertyPlaceholderConfigurer.

<!-- property settings for non-JNDI database connections -->
<bean id="placeholderConfigUuid" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
    <property name="location" value="classpath:database.properties" />
    <property name="placeholderPrefix" value="$DS{" />
</bean>

I know which bean is failing because it appears in the stack trace and because when I replace the $DS{hibernate.dialect} with a static value it works.

I have two questions:

1) Since M2Eclipse is using the same Maven setup as the command line, why does one work and the other fail? 2) How to fix this? I really like the ability to run a single jUnit test from within Eclipse on demand.

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about spring