Skip to content

Commit bcf4f72

Browse files
committed
Deprecate unused APIs
Related to #4847 Resolves #4866
1 parent f050bd7 commit bcf4f72

15 files changed

+58
-17
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/JobFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2022 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.
@@ -21,8 +21,9 @@
2121
* Strategy for creating a single job.
2222
*
2323
* @author Dave Syer
24-
*
24+
* @author Mahmoud Ben Hassine
2525
*/
26+
@Deprecated(since = "6.0", forRemoval = true)
2627
public interface JobFactory {
2728

2829
/**

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/JobRegistry.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.springframework.batch.core.configuration;
1717

18+
import java.util.Collection;
19+
1820
import org.springframework.batch.core.Job;
1921

2022
/**
@@ -25,7 +27,14 @@
2527
* @author Mahmoud Ben Hassine
2628
*
2729
*/
28-
public interface JobRegistry extends ListableJobLocator {
30+
public interface JobRegistry extends JobLocator {
31+
32+
/**
33+
* Provides the currently registered job names. The return value is unmodifiable and
34+
* disconnected from the underlying registry storage.
35+
* @return a collection of String. Empty if none are registered.
36+
*/
37+
Collection<String> getJobNames();
2938

3039
/**
3140
* Registers a {@link Job} at runtime.

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/ListableJobLocator.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2007 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.
@@ -21,8 +21,11 @@
2121
* A listable extension of {@link JobLocator}.
2222
*
2323
* @author Dave Syer
24-
*
24+
* @author Mahmoud Ben Hassine
25+
* @deprecated since 6.0, scheduled for removal in 6.2 or later. Use {@link JobRegistry}
26+
* instead.
2527
*/
28+
@Deprecated(since = "6.0", forRemoval = true)
2629
public interface ListableJobLocator extends JobLocator {
2730

2831
/**

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/AutomaticJobRegistrarBeanPostProcessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022-2023 the original author or authors.
2+
* Copyright 2022-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.
@@ -30,7 +30,9 @@
3030
*
3131
* @author Mahmoud Ben Hassine
3232
* @since 5.0
33+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
3334
*/
35+
@Deprecated(since = "6.0", forRemoval = true)
3436
class AutomaticJobRegistrarBeanPostProcessor implements BeanFactoryPostProcessor, BeanPostProcessor {
3537

3638
private ConfigurableListableBeanFactory beanFactory;

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/EnableBatchProcessing.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.springframework.batch.core.configuration.JobRegistry;
1919
import org.springframework.batch.core.configuration.support.ApplicationContextFactory;
2020
import org.springframework.batch.core.configuration.support.AutomaticJobRegistrar;
21+
import org.springframework.batch.core.configuration.support.GroupAwareJob;
2122
import org.springframework.batch.core.configuration.support.ScopeConfiguration;
2223
import org.springframework.batch.core.converter.JobParametersConverter;
2324
import org.springframework.batch.core.repository.JobRepository;
@@ -156,7 +157,10 @@
156157
* {@link ApplicationContextFactory}.
157158
* @return boolean indicating whether the configuration is going to be modularized
158159
* into multiple application contexts. Defaults to {@code false}.
160+
* @deprecated since 6.0 in favor of Spring's context hierarchies and
161+
* {@link GroupAwareJob}s. Scheduled for removal in 6.2 or later.
159162
*/
163+
@Deprecated(since = "6.0", forRemoval = true)
160164
boolean modular() default false;
161165

162166
/**

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AbstractApplicationContextFactory.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.
@@ -47,7 +47,10 @@
4747
* every time it is requested. It is lazily initialized and cached. Clients should ensure
4848
* that it is closed when it is no longer needed. If a path is not set, the parent is
4949
* always returned.
50+
*
51+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
5052
*/
53+
@Deprecated(since = "6.0", forRemoval = true)
5154
public abstract class AbstractApplicationContextFactory implements ApplicationContextFactory, ApplicationContextAware {
5255

5356
private static final Log logger = LogFactory.getLog(AbstractApplicationContextFactory.class);

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ApplicationContextFactory.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2022 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.
@@ -25,7 +25,10 @@
2525
* primarily useful when creating a new {@link ApplicationContext} for a {@link Job}.
2626
*
2727
* @author Lucas Ward
28+
* @author Mahmoud Ben Hassine
29+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
2830
*/
31+
@Deprecated(since = "6.0", forRemoval = true)
2932
public interface ApplicationContextFactory {
3033

3134
ConfigurableApplicationContext createApplicationContext();

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ApplicationContextJobFactory.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.
@@ -26,8 +26,10 @@
2626
*
2727
* @author Dave Syer
2828
* @author Mahmoud Ben Hassine
29+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
2930
*
3031
*/
32+
@Deprecated(since = "6.0", forRemoval = true)
3133
public class ApplicationContextJobFactory implements JobFactory {
3234

3335
private final Job job;

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/AutomaticJobRegistrar.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.
@@ -42,7 +42,9 @@
4242
* @author Dave Syer
4343
* @author Mahmoud Ben Hassine
4444
* @since 2.1
45+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
4546
*/
47+
@Deprecated(since = "6.0", forRemoval = true)
4648
public class AutomaticJobRegistrar implements Ordered, SmartLifecycle, ApplicationContextAware, InitializingBean {
4749

4850
private final Collection<ApplicationContextFactory> applicationContextFactories = new ArrayList<>();

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ClasspathXmlApplicationContextsFactoryBean.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2022 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.
@@ -35,8 +35,9 @@
3535
*
3636
* @author Dave Syer
3737
* @author Mahmoud Ben Hassine
38-
*
38+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
3939
*/
40+
@Deprecated(since = "6.0", forRemoval = true)
4041
public class ClasspathXmlApplicationContextsFactoryBean
4142
implements FactoryBean<ApplicationContextFactory[]>, ApplicationContextAware {
4243

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
* @author Dave Syer
4747
* @author Stephane Nicoll
4848
* @author Mahmoud Ben Hassine
49+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
4950
*/
51+
@Deprecated(since = "6.0", forRemoval = true)
5052
public class DefaultJobLoader implements JobLoader, InitializingBean {
5153

5254
private static final Log logger = LogFactory.getLog(DefaultJobLoader.class);

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/GenericApplicationContextFactory.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.
@@ -39,7 +39,10 @@
3939
* the child {@link ApplicationContext} is returned. The child context is not re-created
4040
* every time it is requested. It is lazily initialized and cached. Clients should ensure
4141
* that it is closed when it is no longer needed.
42+
*
43+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
4244
*/
45+
@Deprecated(since = "6.0", forRemoval = true)
4346
public class GenericApplicationContextFactory extends AbstractApplicationContextFactory {
4447

4548
/**

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobFactoryRegistrationListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
*
2929
* @author Dave Syer
3030
* @author Mahmoud Ben Hassine
31-
*
31+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
3232
*/
33+
@Deprecated(since = "6.0", forRemoval = true)
3334
public class JobFactoryRegistrationListener {
3435

3536
private final Log logger = LogFactory.getLog(getClass());

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobLoader.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-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,8 +22,11 @@
2222

2323
/**
2424
* @author Dave Syer
25+
* @author Mahmoud Ben Hassine
2526
* @since 2.1
27+
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
2628
*/
29+
@Deprecated(since = "6.0", forRemoval = true)
2730
public interface JobLoader {
2831

2932
/**

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ReferenceJobFactory.java

Lines changed: 4 additions & 2 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.
@@ -23,8 +23,10 @@
2323
* {@link Job}.
2424
*
2525
* @author Dave Syer
26-
*
26+
* @author Mahmoud Ben Hassine
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 ReferenceJobFactory implements JobFactory {
2931

3032
private final Job job;

0 commit comments

Comments
 (0)