Deprecate unused APIs

Related to #4847
Resolves #4866
This commit is contained in:
Mahmoud Ben Hassine
2025-06-09 12:10:30 +02:00
parent f050bd7062
commit bcf4f724ad
15 changed files with 58 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +21,9 @@ import org.springframework.batch.core.Job;
* Strategy for creating a single job.
*
* @author Dave Syer
*
* @author Mahmoud Ben Hassine
*/
@Deprecated(since = "6.0", forRemoval = true)
public interface JobFactory {
/**

View File

@@ -15,6 +15,8 @@
*/
package org.springframework.batch.core.configuration;
import java.util.Collection;
import org.springframework.batch.core.Job;
/**
@@ -25,7 +27,14 @@ import org.springframework.batch.core.Job;
* @author Mahmoud Ben Hassine
*
*/
public interface JobRegistry extends ListableJobLocator {
public interface JobRegistry extends JobLocator {
/**
* Provides the currently registered job names. The return value is unmodifiable and
* disconnected from the underlying registry storage.
* @return a collection of String. Empty if none are registered.
*/
Collection<String> getJobNames();
/**
* Registers a {@link Job} at runtime.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +21,11 @@ import java.util.Collection;
* A listable extension of {@link JobLocator}.
*
* @author Dave Syer
*
* @author Mahmoud Ben Hassine
* @deprecated since 6.0, scheduled for removal in 6.2 or later. Use {@link JobRegistry}
* instead.
*/
@Deprecated(since = "6.0", forRemoval = true)
public interface ListableJobLocator extends JobLocator {
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022-2023 the original author or authors.
* Copyright 2022-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,9 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
*
* @author Mahmoud Ben Hassine
* @since 5.0
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
*/
@Deprecated(since = "6.0", forRemoval = true)
class AutomaticJobRegistrarBeanPostProcessor implements BeanFactoryPostProcessor, BeanPostProcessor {
private ConfigurableListableBeanFactory beanFactory;

View File

@@ -18,6 +18,7 @@ package org.springframework.batch.core.configuration.annotation;
import org.springframework.batch.core.configuration.JobRegistry;
import org.springframework.batch.core.configuration.support.ApplicationContextFactory;
import org.springframework.batch.core.configuration.support.AutomaticJobRegistrar;
import org.springframework.batch.core.configuration.support.GroupAwareJob;
import org.springframework.batch.core.configuration.support.ScopeConfiguration;
import org.springframework.batch.core.converter.JobParametersConverter;
import org.springframework.batch.core.repository.JobRepository;
@@ -156,7 +157,10 @@ public @interface EnableBatchProcessing {
* {@link ApplicationContextFactory}.
* @return boolean indicating whether the configuration is going to be modularized
* into multiple application contexts. Defaults to {@code false}.
* @deprecated since 6.0 in favor of Spring's context hierarchies and
* {@link GroupAwareJob}s. Scheduled for removal in 6.2 or later.
*/
@Deprecated(since = "6.0", forRemoval = true)
boolean modular() default false;
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2023 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,10 @@ import org.springframework.util.ClassUtils;
* every time it is requested. It is lazily initialized and cached. Clients should ensure
* that it is closed when it is no longer needed. If a path is not set, the parent is
* always returned.
*
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
*/
@Deprecated(since = "6.0", forRemoval = true)
public abstract class AbstractApplicationContextFactory implements ApplicationContextFactory, ApplicationContextAware {
private static final Log logger = LogFactory.getLog(AbstractApplicationContextFactory.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,10 @@ import org.springframework.context.ConfigurableApplicationContext;
* primarily useful when creating a new {@link ApplicationContext} for a {@link Job}.
*
* @author Lucas Ward
* @author Mahmoud Ben Hassine
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
*/
@Deprecated(since = "6.0", forRemoval = true)
public interface ApplicationContextFactory {
ConfigurableApplicationContext createApplicationContext();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2023 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,8 +26,10 @@ import org.springframework.context.ConfigurableApplicationContext;
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
*
*/
@Deprecated(since = "6.0", forRemoval = true)
public class ApplicationContextJobFactory implements JobFactory {
private final Job job;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2023 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,9 @@ import org.springframework.util.Assert;
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @since 2.1
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
*/
@Deprecated(since = "6.0", forRemoval = true)
public class AutomaticJobRegistrar implements Ordered, SmartLifecycle, ApplicationContextAware, InitializingBean {
private final Collection<ApplicationContextFactory> applicationContextFactories = new ArrayList<>();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,8 +35,9 @@ import org.springframework.core.io.Resource;
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
*/
@Deprecated(since = "6.0", forRemoval = true)
public class ClasspathXmlApplicationContextsFactoryBean
implements FactoryBean<ApplicationContextFactory[]>, ApplicationContextAware {

View File

@@ -46,7 +46,9 @@ import org.springframework.util.Assert;
* @author Dave Syer
* @author Stephane Nicoll
* @author Mahmoud Ben Hassine
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
*/
@Deprecated(since = "6.0", forRemoval = true)
public class DefaultJobLoader implements JobLoader, InitializingBean {
private static final Log logger = LogFactory.getLog(DefaultJobLoader.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2023 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,10 @@ import java.util.List;
* the child {@link ApplicationContext} is returned. The child context is not re-created
* every time it is requested. It is lazily initialized and cached. Clients should ensure
* that it is closed when it is no longer needed.
*
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
*/
@Deprecated(since = "6.0", forRemoval = true)
public class GenericApplicationContextFactory extends AbstractApplicationContextFactory {
/**

View File

@@ -28,8 +28,9 @@ import org.springframework.batch.core.configuration.JobRegistry;
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
*/
@Deprecated(since = "6.0", forRemoval = true)
public class JobFactoryRegistrationListener {
private final Log logger = LogFactory.getLog(getClass());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,8 +22,11 @@ import org.springframework.batch.core.configuration.DuplicateJobException;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @since 2.1
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
*/
@Deprecated(since = "6.0", forRemoval = true)
public interface JobLoader {
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2023 the original author or authors.
* Copyright 2006-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,8 +23,10 @@ import org.springframework.batch.core.configuration.JobFactory;
* {@link Job}.
*
* @author Dave Syer
*
* @author Mahmoud Ben Hassine
* @deprecated since 6.0 with no replacement. Scheduled for removal in 6.2 or later.
*/
@Deprecated(since = "6.0", forRemoval = true)
public class ReferenceJobFactory implements JobFactory {
private final Job job;