tags:

views:

21

answers:

1

I have the following partial spring context xml file:

<bean name="template" class="org.springframework.jdbc.core.JdbcTemplate">
  <property name="dataSource" ref="dataSource" />
</bean>

<bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  <property name="driverClassLoader" value="" /> <!-- THIS PROPERTY -->
  <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  <property name="url" value="jdbc:mysql://localhost:3061/my_database" />
  <property name="username" value="username" />
  <property name="password" value="password" />
  <property name="initialSize" value="8" />
</bean>

How do I inject the driverClassLoader property? (I'm using some custom plug-in architecture but not the spring dm server so have to provide a classloader to find the mysql driver)

A: 

I think you want to use the PropertyPlaceholderConfigurer. Look at section 3.7.2.1 in the Spring 2.0 reference guide.

Javid Jamae