zoukankan      html  css  js  c++  java
  • spring Existing transaction found for transaction marked with propagation 'never' 解决

    先在申明事务中配置了所有的事务

        <!--配置事物传播策略,以及隔离级别-->
        <tx:advice id="txAdvice" transaction-manager="jdbcTransactionManager">
            <tx:attributes>
                <!-- 注入事务策略 -->
                <tx:method name="delet*"  propagation="REQUIRED" isolation="READ_COMMITTED" rollback-for="Exception"/>
                <tx:method name="updat*"  propagation="REQUIRED" isolation="READ_COMMITTED" rollback-for="Exception"/>
                <tx:method name="delet*"  propagation="REQUIRED" isolation="READ_COMMITTED" rollback-for="Exception"/>
                <tx:method name="inser*"  propagation="REQUIRED" isolation="READ_COMMITTED" rollback-for="Exception"/>
    <!--
                <tx:method name="*" propagation="REQUIRED" isolation="READ_COMMITTED"/>
    -->
            </tx:attributes>
        </tx:advice>

    因为配置了 

    <tx:method name="*" propagation="REQUIRED" isolation="READ_COMMITTED"/>  所有所有的事务都是REQUIRED

    service 实现层配置了注解方式
        @Override
       @Transactional(propagation = Propagation.NEVER,rollbackFor = Exception.class)
        public void never() {
            dao.queryInfo();
        }

    传播级别是NEVER 报出:

    HTTP Status 500 - Request processing failed; nested exception is org.springframework.transaction.IllegalTransactionStateException: Existing transaction found for transaction marked with propagation 'never'

    解决:将配置文件的

    <tx:method name="*" propagation="REQUIRED" isolation="READ_COMMITTED"/> 
    删除掉


  • 相关阅读:
    hdu5754_找规律+威佐夫博弈
    codeforce645C_尺取法
    hdu4336_容斥dp
    poj3071_概率dp
    codeforces148D_推论题
    poj2151_概率dp
    hdu3853_概率dp
    POJ 1410 判断线段与矩形交点或在矩形内
    POJ 1066 Treasure Hunt 线段相交判断
    POJ 2653 Pick-up sticks 判断线段相交
  • 原文地址:https://www.cnblogs.com/blogxiao/p/10133433.html
Copyright © 2011-2022 走看看