Change default transaction manager type to JdbcTransactionManager
This commits changes the type of the transaction manager from `DataSourceTransactionManager` to `JdbcTransactionManager` in the default configuration of `@EnableTask`. The `JdbcTransactionManager` adds common JDBC exception translation which is beneficial for Spring Cloud Task to improve exception handling and error reporting. Polishing
This commit is contained in:
committed by
Glenn Renfro
parent
7085cbc735
commit
26c9d43c0b
@@ -31,7 +31,7 @@ import org.springframework.cloud.task.repository.support.SimpleTaskExplorer;
|
||||
import org.springframework.cloud.task.repository.support.SimpleTaskRepository;
|
||||
import org.springframework.cloud.task.repository.support.TaskExecutionDaoFactoryBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.jdbc.support.JdbcTransactionManager;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
@@ -48,6 +48,7 @@ import org.springframework.transaction.PlatformTransactionManager;
|
||||
*
|
||||
* @author Glenn Renfro
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class DefaultTaskConfigurer implements TaskConfigurer {
|
||||
|
||||
@@ -144,7 +145,7 @@ public class DefaultTaskConfigurer implements TaskConfigurer {
|
||||
}
|
||||
finally {
|
||||
if (this.transactionManager == null) {
|
||||
this.transactionManager = new DataSourceTransactionManager(this.dataSource);
|
||||
this.transactionManager = new JdbcTransactionManager(this.dataSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user