spring-cloud / spring-cloud/spring-cloud-task
Task doesn't use transaction manager on startup
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 446
- Forks
- 310
- Avg merge
- 18h 18m
- Merged PRs (30d)
- 6
Description
This could be intended behavior, but when an spring cloud task is starting up, it doesn't use the transaction manager when initializing the execution.
Take as an example spring-cloud-task-samples/multiple-datasources. If we change the secondDataSource to disable autocommit, the application will immediately fail on startup because the creation of the execution will be rolled back immediately. after creating it.
@Bean
public DataSource secondDataSource() throws SQLException {
DataSource ds = new EmbeddedDatabaseBuilder()
.setType(EmbeddedDatabaseType.H2)
.build();
SimpleDriverDataSource sdds = ds.unwrap(SimpleDriverDataSource.class);
Properties properties = new Properties();
properties.setProperty("autoCommit", "false");
sdds.setConnectionProperties(properties);
return ds;
}
So either all the initialization code should get wrapped in transaction(s), or the documentation should be updated to reflect that you only support data sources with auto-commit set to true.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.