SSM Connection is read-only. Queries leading to data modification are not allowed

SSM在mybatis执行存储过程时报Connection is read-only. Queries leading to data modification are not allowed

需要检查applicationContext.xml的配置,看看是不是设置了只读

   <tx:advice transaction-manager="transactionManager" id="adviceId">
        <tx:attributes>
        <!--  其中*为通配符,即代表以find为开头的所有方法,即表示符合此命名规则的方法作为一个事务。 -->
         <!--propagation="REQUIRED"代表支持当前事务,如果当前没有事务,就新建一个事务。这是最常见的选择-->
            <!--propagation="SUPPORTS" 支持当前事务,如果当前没有事务,就以非事务方式执行。 -->
         <!-- isolation DEFAULT:采用数据库默认隔离级别 -->
            <!--read-only   事务是否只读?-->
            <tx:method name="find*" read-only="true"/>
            <tx:method name="select*" read-only="true"/>
            <tx:method name="query*" read-only="false" propagation="REQUIRED" isolation="DEFAULT"/>
            <tx:method name="save*" read-only="false" propagation="REQUIRED"/>
            <tx:method name="update*" read-only="false" propagation="REQUIRED"/>
            <tx:method name="delete*" read-only="false" propagation="REQUIRED"/>
            <tx:method name="insert*" read-only="false" propagation="REQUIRED"/>
        </tx:attributes>
    </tx:advice>
原文地址:https://www.cnblogs.com/flyxlee/p/14073261.html