<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/mytest1</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>123</value>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
<bean id="helloDao" class="com.gc.action.HelloDao">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<!-- <property name="transactionManager">
<ref bean="transactionManager"/>
</property> -->
</bean>
<bean id="helloDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean = "transactionManager"/>
</property>
<property name="target">
<ref bean="helloDao"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="create*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
Spring之DBCP连接池注入实例
最新推荐文章于 2023-11-30 17:21:24 发布