英文:
Spring Batch without DB in Spring 6
问题
我正在我的应用程序中使用Spring Batch,在Spring 4之前,我们可以使用基于Map的作业存储库,因此它没有依赖于数据库。但最近我们迁移到了Spring 6,其中Spring删除了基于Map的存储库。这是从他们的文档中提取的:
“从历史上看,Spring Batch提供了基于Map的作业存储库和作业资源管理器实现,用于与内存中的作业存储库一起工作。这些实现在版本4中已被弃用,并在版本5中完全删除。建议的替代方法是使用基于JDBC的实现,配合嵌入式数据库,如H2、HSQL等。”
我不想让我的应用程序依赖于数据库,并且由于某种原因,我的组织不允许我使用内存数据库。在Spring Batch的最新版本中,是否有一种方法可以去除对数据库的依赖?
我已经尝试过使用H2和MySQL。两者都可以正常工作,但无法找到在没有任何JDBC的情况下工作的方法。
英文:
I am using Spring Batch in my application, till Spring 4 we could use Map based job repository so it didn't have DB dependency. But recently we migrated to Spring 6 in which Spring has removed Map based repository. This is from their documentation:
“Historically, Spring Batch provided a map-based job repository and job explorer implementations to work with an in-memory job repository. These implementations were deprecated in version 4 and completely removed in version 5. The recommended replacement is to use the JDBC-based implementations with an embedded database, such as H2, HSQL, and others”
I don't want my application to have any dependency on DB and due to some reason my organization is not letting me use in memory database. Is there any way we can remove this dependency on DB in Spring Batch for latest version.
I have tried using H2 and MySql. Both are working fine but not able to figure out a way to work without any JDBC.
答案1
得分: 1
如果您不想或不能使用内存数据库,那么您必须提供自己的JobRepository
接口实现,并将其与您的作业和步骤一起使用。
英文:
> I don't want my application to have any dependency on DB and due to some reason my organization is not letting me use in memory database
If you don't want or can't use an in-memory database, then you have to provide your own implementation of the JobRepository
interface and use it with your jobs and steps.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论