张洛北
2016-04-22 18:02
能不能给份代码啊 老师
				<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
						http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
						http://www.springframework.org/schema/tx 
						http://www.springframework.org/schema/tx/spring-tx-3.2.xsd 
						http://www.springframework.org/schema/aop 
						http://www.springframework.org/schema/aop/spring-aop-3.2.xsd 
						http://www.springframework.org/schema/context 
						http://www.springframework.org/schema/context/spring-context-3.2.xsd ">
	<!-- 引入属性文件 -->
	<context:property-placeholder location="classpath:db.properties" />
	<!-- 配置c3p0连接池 -->
	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
		<property name="driverClass" value="${core.driverClassName}" />
		<property name="jdbcUrl" value="${core.url}" />
		<property name="user" value="${core.username}" />
		<property name="password" value="${core.password}" />
	</bean>
	<!-- 配置业务层 -->
	<bean id="accountService" class="com.spring.demo3.AccountServiceImpl">
		<property name="accountDao" ref="accountDao" />
	</bean>
	<!-- 配置dao层 -->
	<bean id="accountDao" class="com.spring.demo3.AccountDaoImpl">
		<property name="dataSource" ref="dataSource" />
	</bean>
	<!-- 配置事务管理器 -->
	<bean id="transactionManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>
	<!-- 开启注解事务 -->
	<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>Spring事务管理
87322 学习 · 205 问题
相似问题