If no rules are relevant to the exception, it will be treated like DefaultTransactionAttribute
(rolling back on runtime exceptions).
如果光光注解 @Transactional 那么只会对运行时异常的回滚有效比如nullpointexception,而不会对非运行时异常有效比如io exception
Errors也会导致事务回滚
noRollbackFor 方法对throwable的子类进行不回滚处理配置
rollbackFor 为
throwable的子类增加回滚处理配置
MyBatis自动参与到spring事务管理中,无需额外配置,只要org.mybatis.spring.SqlSessionFactoryBean引用的数据源与DataSourceTransactionManager引用的数据源一致即可,否则事务管理会不起作用。
PROPAGATION_REQUIRED, readOnly 事务为如果当前有事务就用这个事务,如果没有 就新建一个。并且为只读
一般用于查询事务