Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition. 该段错误的原因是在保存或者更新数据的时候事务异常,检查一下service里面的方法名是否符合spring配置文件里面的事务提交规则.…
转自:https://blog.csdn.net/sgls652709/article/details/49472719 前言 在利用单元测试验证spring事务传播机制的时候出现了下面的异常: Transaction rolled back because it has been marked as rollback-only.记录问题解决的步骤 正文 代码示例 代码-测试单元 @RunWith(SpringJUnit4ClassRunner.class) @ContextConfigurat…
今日在写GenericDao时,发现了一个异常,内容如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'genericDao' defined in class path resource [spring.common.xml]: Invocation of init method failed; nested exception is java.lang.Ille…