springbatch 发表于 2022-3-9 16:07:07

Spring Batch 5.0 中的新增功能

Spring Batch 5.0 版本具有以下主要主题:


[*]Java 17 要求
[*]依赖关系重新基线
[*]批量基础结构配置更新
[*]修剪

Java 17 要求Spring Batch 遵循 Spring Framework 的 Java 版本和第三方依赖项的基线。随着 Spring Batch 5,Spring Framework 版本正在升级到需要 Java 17 的 Spring Framework 6。因此,Spring Batch 的 Java 版本要求也增加到 Java 17。
依赖关系重新基线为了继续与 Spring Batch 使用的第三方库的受支持版本集成,Spring Batch 5 将全面更新依赖项到以下版本:

[*]Spring Framework 6
[*]Spring Integration 6
[*]Spring Data 3
[*]Spring AMQP 3
[*]Spring for Apache Kafka 3
[*]Micrometer 2

此版本还标志着向 Jakarta EE 9 API 的迁移。
批量基础结构配置更新数据源需求更新从历史上看,Spring Batch 提供了一个基于 Map 的作业存储库和作业浏览器实现,以使用内存中的作业存储库。这些实现在版本 4 中已被弃用,并在版本 5 中完全删除。推荐的替代方法是使用基于 Jdbc 的实现和嵌入式数据库,如 H2、HSQL 等。
在这个版本中,@EnableBatchProcessing注解将配置一个基于 Jdbc的应用程序上下文JobRepository中需要一个 DataSourcebean。DataSourcebean 可以引用嵌入式数据库以使用内存中的作业存储库。
事务管理器 bean 暴露直到版本 4.3,@EnableBatchProcessing注释在应用程序上下文中公开了一个事务管理器 bean。虽然这在许多情况下很方便,但事务管理器的无条件公开可能会干扰用户定义的事务管理器。在此版本中,@EnableBatchProcessing不再在应用程序上下文中公开事务管理器 bean。
修剪已弃用的 API 移除以下 API 在以前的版本中已弃用,在此版本中已删除:

[*]Classorg.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean
[*]Class org.springframework.batch.core.repository.dao.MapExecutionContextDao
[*]Class org.springframework.batch.core.repository.dao.MapJobExecutionDao
[*]Class org.springframework.batch.core.repository.dao.MapJobInstanceDao
[*]Class org.springframework.batch.core.repository.dao.MapStepExecutionDao
[*]Class org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean
[*]Class org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer
[*]Class org.springframework.batch.core.configuration.support.ClassPathXmlJobRegistry
[*]Class org.springframework.batch.core.configuration.support.ClassPathXmlApplicationContextFactory
[*]Class org.springframework.batch.core.launch.support.ScheduledJobParametersFactory
[*]Class org.springframework.batch.item.data.AbstractNeo4jItemReader
[*]Class org.springframework.batch.item.database.support.ListPreparedStatementSetter
[*]Class org.springframework.batch.integration.chunk.RemoteChunkingMasterStepBuilder
[*]Class org.springframework.batch.integration.chunk.RemoteChunkingMasterStepBuilderFactory
[*]Class org.springframework.batch.integration.partition.RemotePartitioningMasterStepBuilder
[*]Class org.springframework.batch.integration.partition.RemotePartitioningMasterStepBuilderFactory
[*]Class org.springframework.batch.test.AbstractJobTests
[*]Class org.springframework.batch.item.xml.StaxUtils
[*]Class org.springframework.batch.item.file.transform.Alignment
[*]Class org.springframework.batch.core.JobExecution#stop()
[*]Class org.springframework.batch.core.JobParameters#getDouble(String key, double defaultValue)
[*]Class org.springframework.batch.core.JobParameters#getLong(String key, long defaultValue)
[*]Class org.springframework.batch.core.partition.support.SimpleStepExecutionSplitter(JobRepository jobRepository, Step step, Partitioner partitioner)
[*]方法org.springframework.batch.core.partition.support.SimpleStepExecutionSplitter#getStartable(StepExecution stepExecution, ExecutionContext context)
[*]方法org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean#getJobRepository()
[*]方法org.springframework.batch.item.database.AbstractCursorItemReader#cleanupOnClose()
[*]方法org.springframework.batch.item.database.HibernateItemWriter#doWrite(HibernateOperations hibernateTemplate, List<? extends T> items)
[*]方法org.springframework.batch.item.database.JdbcCursorItemReader#cleanupOnClose()
[*]方法org.springframework.batch.item.database.StoredProcedureItemReader#cleanupOnClose()
[*]方法org.springframework.batch.item.database.builder.HibernatePagingItemReaderBuilder#useSatelessSession(boolean useStatelessSession)
[*]方法org.springframework.batch.item.file.MultiResourceItemReader#getCurrentResource()
[*]方法org.springframework.batch.integration.config.annotation.BatchIntegrationConfiguration#remoteChunkingMasterStepBuilderFactory()
[*]方法org.springframework.batch.integration.config.annotation.BatchIntegrationConfiguration#remotePartitioningMasterStepBuilderFactory()
[*][方法org.springframework.batch.item.util.FileUtils#setUpOutputFile(File file, boolean restarted, boolean overwriteOutputFile)

SQLFire 支持删除SqlFire 已于 2014 年 11 月 1 日宣布停产。SQLFire 作为作业存储库的支持在 4.3 版中已弃用,并在 5.0 版中删除。
JSR-352 实现删除由于缺乏采用,JSR-352 的实现已在此版本中删除。

页: [1]
查看完整版本: Spring Batch 5.0 中的新增功能