日期:2014-05-17  浏览次数:20590 次

关于ibatis+spring整合spring声明式事物不起作用的问题
spring的配置文件:

<?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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

<!-- 读取jdbc配置文件中的数据库资源 -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<!-- properties文件为只读 -->
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"></property>
<!-- 如果找不到该文件就忽略 -->
<property name="ignoreResourceNotFound" value="true"></property>
<property name="locations">
<list>
<!-- 数据库配置文件 -->
<value>classpath*:com/booklive/resources/config/jdbc.properties</value>
</list>
</property>
</bean>
<!-- 配置数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}"></property>
<property name="url" value="${jdbc.url}"></property>
<property name="username" value="${jdbc.username}"></property>
<property name="password" value="${jdbc.password}"></property>
<!-- 最大连接数据库连接数,设置为0时,表示没有限制 -->
<property name="maxActive" value="200"></property>
<!-- 最大等待连接中的数量,设置为0时,表示没有限制 -->
<property name="maxIdle" value="10"></property>
<!-- 最大等待秒数,单位为毫秒, 超过时间会报出错误信息 -->
<property name="maxWait" value="60"></property>
<property name="initialSize" value="5"></property>
<!-- 是否自我中断,默认是 false -->