ManagedTransaction 类型 MANAGED
<transactionManager type="MANAGED"> <property name="closeConnection" value="false"/> </transactionManager>
这玩意单独使用mybatis的时候不带事务。 坑的一p
public void commit() throws SQLException { } public void rollback() throws SQLException { } public void close() throws SQLException { if (this.closeConnection && this.connection != null) { if (log.isDebugEnabled()) { log.debug("Closing JDBC Connection [" + this.connection + "]"); } this.connection.close(); } } protected void openConnection() throws SQLException { if (log.isDebugEnabled()) { log.debug("Openning JDBC Connection"); } this.connection = this.dataSource.getConnection(); if (this.level != null) { this.connection.setTransactionIsolation(this.level.getLevel()); } }看到没 就这rollback 和commit 是空的