-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Labels
status: waiting-for-triageIssues that we did not analyse yetIssues that we did not analyse yettype: bug
Description
Bug description
When using @EnableMongoJobRepository with @EnableBatchProcessing, you will receive an error saying Invalid transaction attribute token: [SERIALIZABLE]
Environment
- Spring Boot 4.0.0
- Spring Batch 6.0.0
- Java 25
Steps to reproduce
- Create a new Spring Boot project through the Initializr with Spring Batch and Spring Data MongoDB selected.
- Create a configuration class and annotate it with
@EnableBatchProcessingand@EnableMongoJobRepository - Implement a simple job
- Add MongoDB properties to
application.yml
Expected behavior
Job should run without issue
Minimal Complete Reproducible example
SimpleJobConfig.java
@EnableBatchProcessing
@EnableMongoJobRepository
@Configuration
public class SimpleJobConfig {
@Bean
Job simpleJob(Step simpleStep, JobRepository jobRepository) {
return new JobBuilder(jobRepository)
.incrementer(new RunIdIncrementer())
.start(simpleStep)
.build();
}
@Bean
Step simpleStep(Tasklet simpleTasklet, PlatformTransactionManager transactionManager, JobRepository jobRepository) {
return new StepBuilder("simpleStep", jobRepository)
.tasklet(simpleTasklet, transactionManager)
.build();
}
@Bean
Tasklet simpleTasklet() {
return (contribution, chunkContext) -> {
println("test");
return RepeatStatus.FINISHED;
};
}
@Bean
MongoTransactionManager transactionManager(MongoDatabaseFactory mongoDatabaseFactory) {
return new MongoTransactionManager(mongoDatabaseFactory);
}
}application.yml
spring:
application:
name: batch-mongo-demo
mongodb:
host: (removed)
port: 27017
database: batchbanseok1216
Metadata
Metadata
Assignees
Labels
status: waiting-for-triageIssues that we did not analyse yetIssues that we did not analyse yettype: bug