乱七八糟。。
-- springmvc-servlet.xml
-- sqlite(mysql也行吧没试)
-- 方法内不需要手动和注解方式添加
<!-- 配置数据源事务 -->
<bean id="transactionManager"class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 开启注解(不需要了)
<tx:annotation-driven transaction-manager="transactionManager" /> -->
<context:component-scan base-package="com.chy.www.*">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Service" />
</context:component-scan>
<!-- aop事务不需要再方法上添加注解 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="find*" propagation="REQUIRED" read-only="true" />
<tx:method name="select*" propagation="REQUIRED" read-only="true" />
<!-- <tx:method name="add*" propagation="REQUIRED" isolation="SERIALIZABLE" />
<tx:method name="update*" propagation="REQUIRED" isolation="SERIALIZABLE" />
<tx:method name="delete*" propagation="REQUIRED" isolation="SERIALIZABLE" />
<tx:method name="save*" propagation="REQUIRED" isolation="SERIALIZABLE" /> -->
<tx:method name="*" propagation="REQUIRED" isolation="SERIALIZABLE" />
</tx:attributes>
</tx:advice>
<aop:config proxy-target-class="true">
<aop:pointcut expression="execution(* com.chy.www..*(..))" id="serviceMethod" />
<aop:advisor pointcut-ref="serviceMethod" advice-ref="txAdvice" />
</aop:config>