Spring事务 Connection is read-only. Queries leading to data modification are not allowed
项目中有遇到此问题,排除查询方法中做了修改数据的情况。

排查发现,项目的aop采用编织方式,xml文件有配置:<aop:aspectj-autoproxy/>
项目最新的改动中有使用EnableAsync标签,其中mode属性指定的默认切面模式为代理
将mode指定为AdviceMode.ASPECTJ后,问题解决。初步认为在编织aop的情况下,EnableAsync的默认切面方式影响到了spring事务的处理。

浙公网安备 33010602011771号