I’m creating my Spring context inside a static main method with
return new ClassPathXmlApplicationContext("applicationContext.xml");
Inside applicationContext.xml I’m wiring one of my beans with
<bean id="dataSource"
class="org.springframework.jdbc.datasource.SingleConnectionDataSource">
<property name="driverClassName">
<value>${db.driverclassname}</value>
</property>
...
</bean>
I’ve got a .properties file on my class path that contains the value db.driverclassname.
Unfortunately I’m getting the following error:
Property 'driverClassName' threw exception;
nested exception is java.lang.IllegalStateException:
Could not load JDBC driver class [${db.driverclassname}]
What am I doing wrong? I’m using Spring 2.5.5
Don’t you need a PropertyPlaceholderConfigurer ?
e.g.
This article details usage.