I try it . But it don't work:
Code:
<bean id="MyDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<!-- results in a setDriverClassName(String) call -->
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://127.0.0.1:3306/Hibernate</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value></value>
</property>
<property name="autoCommit">
<value>false</value>
</property>
</bean>
Spring report error:
Code:
07:26:53,981 INFO DefaultListableBeanFactory:409 - Destroying singletons in fac
tory {org.springframework.beans.factory.support.DefaultListableBeanFactory defin
ing beans [MyDataSource,MySessionFactory,fproxy,viewSpringForumController,rewrit
eURLController,postArticleController,urlMapping,viewResolver,formDao]; Root of B
eanFactory hierarchy}
07:26:53,981 ERROR DispatcherServlet:208 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'MyDataSource' defined in resource [/WEB-INF/springmodal-servlet.xml] of
ServletContext: Error setting property values; nested exception is org.springfra
mework.beans.NotWritablePropertyException: Invalid property 'autoCommit' of bean
class [org.apache.commons.dbcp.BasicDataSource]: Property 'autoCommit' is not w
ritable
org.springframework.beans.NotWritablePropertyException: Invalid property 'autoCo
mmit' of bean class [org.apache.commons.dbcp.BasicDataSource]: Property 'autoCom
mit' is not writable
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrappe
rImpl.java:666)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrappe
rImpl.java:588)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrappe
rImpl.java:720)
at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapp
.....................................................................................
...............................................................
This bean don't has this option?