Skip to content

Commit bfe487c

Browse files
committed
Deprecate redundant APIs
This commit deprecates redundant APIs to simplify the way to configure and use Spring Batch. The most notable changes are: - JobLauncher is deprecated in favor of JobOperator - JobExplorer is deprecated in favor of JobRepository - CommandLineJobRunner is deprecated in favor of more modern alternatives like Spring Boot's job Launcher Other APIs that are only used in the newly deprecated APIs have been deprecated as well. Resolves #4847
1 parent 4fbac1f commit bfe487c

File tree

14 files changed

+50
-14
lines changed

14 files changed

+50
-14
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobLauncher.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@
3434
* @author Dave Syer
3535
* @author Taeik Lim
3636
* @author Mahmoud Ben Hassine
37+
*
38+
* @deprecated since 6.0 in favor of {@link JobOperator}. Scheduled for removal in 6.2 or later.
3739
*/
3840
@FunctionalInterface
41+
@Deprecated(since = "6.0", forRemoval = true)
3942
public interface JobLauncher {
4043

4144
/**

spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2023 the original author or authors.
2+
* Copyright 2006-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,12 +41,8 @@
4141
import org.springframework.batch.core.configuration.JobRegistry;
4242
import org.springframework.batch.core.converter.DefaultJobParametersConverter;
4343
import org.springframework.batch.core.converter.JobParametersConverter;
44+
import org.springframework.batch.core.launch.*;
4445
import org.springframework.batch.core.repository.explore.JobExplorer;
45-
import org.springframework.batch.core.launch.JobExecutionNotFailedException;
46-
import org.springframework.batch.core.launch.JobExecutionNotRunningException;
47-
import org.springframework.batch.core.launch.JobExecutionNotStoppedException;
48-
import org.springframework.batch.core.launch.JobLauncher;
49-
import org.springframework.batch.core.launch.NoSuchJobException;
5046
import org.springframework.batch.core.repository.JobRepository;
5147
import org.springframework.beans.factory.BeanDefinitionStoreException;
5248
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
@@ -173,7 +169,10 @@
173169
* @author Mahmoud Ben Hassine
174170
* @author Minsoo Kim
175171
* @since 1.0
172+
*
173+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
176174
*/
175+
@Deprecated(since = "6.0", forRemoval = true)
177176
public class CommandLineJobRunner {
178177

179178
protected static final Log logger = LogFactory.getLog(CommandLineJobRunner.class);

spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JvmSystemExiter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2013 the original author or authors.
2+
* Copyright 2006-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,9 @@
2424
* @author Lucas Ward
2525
* @author Dave Syer
2626
*
27+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
2728
*/
29+
@Deprecated(since = "6.0", forRemoval = true)
2830
public class JvmSystemExiter implements SystemExiter {
2931

3032
/**

spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RuntimeExceptionTranslator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2023 the original author or authors.
2+
* Copyright 2006-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,8 +20,11 @@
2020

2121
/**
2222
* @author Dave Syer
23+
* @author Mahmoud Ben Hassine
2324
*
25+
* @deprecated since 6.0 with no replacement, for removal in 6.2 or later.
2426
*/
27+
@Deprecated(since = "6.0", forRemoval = true)
2528
public class RuntimeExceptionTranslator implements MethodInterceptor {
2629

2730
@Override

spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SystemExiter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2023 the original author or authors.
2+
* Copyright 2006-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,9 @@
2222
*
2323
* @author Lucas Ward
2424
*
25+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
2526
*/
27+
@Deprecated(since = "6.0", forRemoval = true)
2628
public interface SystemExiter {
2729

2830
/**

spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/TaskExecutorJobLauncher.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@
6565
* @since 1.0
6666
* @see JobRepository
6767
* @see TaskExecutor
68+
*
69+
* @deprecated since 6.0 in favor of {@link TaskExecutorJobOperator}. Scheduled for removal in 6.2 or later.
6870
*/
71+
@Deprecated(since = "6.0", forRemoval = true)
6972
public class TaskExecutorJobLauncher implements JobLauncher, InitializingBean {
7073

7174
protected static final Log logger = LogFactory.getLog(TaskExecutorJobLauncher.class);

spring-batch-core/src/main/java/org/springframework/batch/core/repository/explore/JobExplorer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.springframework.batch.core.JobParameters;
2525
import org.springframework.batch.core.StepExecution;
2626
import org.springframework.batch.core.launch.NoSuchJobException;
27+
import org.springframework.batch.core.repository.JobRepository;
2728
import org.springframework.batch.item.ExecutionContext;
2829
import org.springframework.lang.Nullable;
2930

@@ -38,7 +39,10 @@
3839
* @author Mahmoud Ben Hassine
3940
* @author Parikshit Dutta
4041
* @since 2.0
42+
*
43+
* @deprecated since 6.0 in favor of {@link JobRepository}. Scheduled for removal in 6.2 or later.
4144
*/
45+
@Deprecated(since = "6.0", forRemoval = true)
4246
public interface JobExplorer {
4347

4448
/*

spring-batch-core/src/main/java/org/springframework/batch/core/repository/explore/support/AbstractJobExplorerFactoryBean.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2023 the original author or authors.
2+
* Copyright 2006-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,7 +43,10 @@
4343
* @author Dave Syer
4444
* @author Mahmoud Ben Hassine
4545
* @since 2.0
46+
*
47+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
4648
*/
49+
@Deprecated(since = "6.0", forRemoval = true)
4750
public abstract class AbstractJobExplorerFactoryBean implements FactoryBean<JobExplorer>, InitializingBean {
4851

4952
private static final String TRANSACTION_ISOLATION_LEVEL_PREFIX = "ISOLATION_";

spring-batch-core/src/main/java/org/springframework/batch/core/repository/explore/support/JdbcJobExplorerFactoryBean.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.batch.core.repository.explore.support;
1818

19+
import org.springframework.batch.core.repository.support.JdbcJobRepositoryFactoryBean;
1920
import org.springframework.beans.factory.FactoryBean;
2021

2122
/**
@@ -25,9 +26,11 @@
2526
*
2627
* @author Dave Syer
2728
* @author Mahmoud Ben Hassine
28-
* @since 6.0
29+
*
30+
* @deprecated since 6.0 in favor of {@link JdbcJobRepositoryFactoryBean}. Scheduled for removal in 6.2 or later.
2931
*/
3032
@SuppressWarnings("removal")
33+
@Deprecated(since = "6.0", forRemoval = true)
3134
public class JdbcJobExplorerFactoryBean extends JobExplorerFactoryBean {
3235

3336
}

spring-batch-core/src/main/java/org/springframework/batch/core/repository/explore/support/JobExplorerFactoryBean.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.springframework.batch.core.repository.dao.JobExecutionDao;
4343
import org.springframework.batch.core.repository.dao.JobInstanceDao;
4444
import org.springframework.batch.core.repository.dao.StepExecutionDao;
45+
import org.springframework.batch.core.repository.support.JdbcJobRepositoryFactoryBean;
4546
import org.springframework.beans.factory.FactoryBean;
4647
import org.springframework.beans.factory.InitializingBean;
4748
import org.springframework.core.convert.support.ConfigurableConversionService;
@@ -61,8 +62,7 @@
6162
* @author Dave Syer
6263
* @author Mahmoud Ben Hassine
6364
* @since 2.0
64-
* @deprecated Since 6.0 and scheduled for removal in 6.2 in favor of using
65-
* {@link JdbcJobExplorerFactoryBean}.
65+
* @deprecated since 6.0 in favor of {@link JdbcJobRepositoryFactoryBean}. Scheduled for removal in 6.2 or later.
6666
*/
6767
@Deprecated(since = "6.0", forRemoval = true)
6868
public class JobExplorerFactoryBean extends AbstractJobExplorerFactoryBean implements InitializingBean {

0 commit comments

Comments
 (0)