• 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"/> 
    删除掉


  • 相关阅读:
    crmfuxi
    段子
    wsfenxiang
    生成器、列表推导式
    闭包、迭代器、递归
    函数的参数及返回值
    嵌套、作用域、命名空间
    定义、函数的调用
    测试样式
    进制转换
  • 原文地址:https://www.cnblogs.com/blogxiao/p/10133433.html
Copyright © 2020-2023  润新知