-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Still need in-memory DB or datasource setting when use MongoDB as JobRepository #4728
Comments
Thank you for reporting this. Indeed, this is a design issue with the Java configuration style that was inherited from the early version of That said, there should be no issue with the XML configuration style where you can define the mongo job repository without the need for a datasource: <bean id="jobRepository"
class="org.springframework.batch.core.repository.support.MongoJobRepositoryFactoryBean"
p:mongoOperations-ref="mongoOperations" p:transactionManager-ref="mongoTransactionManager" /> Have you tried that? |
I got this, even I set spring.main.allow-bean-definition-overriding=true
|
We have the same issue in our project when using EnableBatchProcessing Were trying multiple different ways to disable H2 and make it work without this dependency but without luck. For example: We are also facing issue with no proper shutdown for mongo repository and seing in the same time
We already created job repository using:
and it is working fine using mongo as job repository but still with H2 dependency. |
Please do a quick search on Github issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:
Bug description
Still need in-memory DB or datasource setting when use MongoDB as JobRepository.
Environment
Spring batch 5.2, Java 17
Steps to reproduce
Create a spring-boot application, use MongoDB as JobRepository following https://github.com/spring-projects/spring-batch/blob/main/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/MongoDBJobRepositoryIntegrationTests.java
Do not setup any datasource or in-memory DB, start the springboot application. Got following error:
If I add hsqldb dependency to pom.xml. The application can start successfully. I tried to start the job, and I can see MongoDB is used as JobRepository.
Expected behavior
A clear and concise description of what you expected to happen.
Minimal Complete Reproducible example
https://github.com/weiz-cn/spring-batch-demo
You need a MongoDB as JobRepository to start the application
The text was updated successfully, but these errors were encountered: