Skip to content

Commit e35c87c

Browse files
committed
Fix tests
1 parent 72694e6 commit e35c87c

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobLoaderConfigurationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-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.
@@ -27,7 +27,7 @@
2727
import org.springframework.batch.core.JobParametersBuilder;
2828
import org.springframework.batch.core.Step;
2929
import org.springframework.batch.core.StepContribution;
30-
import org.springframework.batch.core.configuration.JobLocator;
30+
import org.springframework.batch.core.configuration.JobRegistry;
3131
import org.springframework.batch.core.configuration.support.ApplicationContextFactory;
3232
import org.springframework.batch.core.configuration.support.AutomaticJobRegistrar;
3333
import org.springframework.batch.core.configuration.support.GenericApplicationContextFactory;
@@ -71,7 +71,7 @@ private void testJob(String jobName, BatchStatus status, int stepExecutionCount,
7171
System.arraycopy(config, 0, configs, 1, config.length);
7272
configs[0] = DataSourceConfiguration.class;
7373
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(configs);
74-
Job job = jobName == null ? context.getBean(Job.class) : context.getBean(JobLocator.class).getJob(jobName);
74+
Job job = jobName == null ? context.getBean(Job.class) : context.getBean(JobRegistry.class).getJob(jobName);
7575
JobLauncher jobLauncher = context.getBean(JobLauncher.class);
7676
JobExecution execution = jobLauncher.run(job,
7777
new JobParametersBuilder().addLong("run.id", (long) (Math.random() * Long.MAX_VALUE))

spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobRegistryJobParserTests.java

Lines changed: 3 additions & 3 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.
@@ -19,7 +19,7 @@
1919

2020
import org.junit.jupiter.api.Test;
2121
import org.springframework.batch.core.Job;
22-
import org.springframework.batch.core.configuration.ListableJobLocator;
22+
import org.springframework.batch.core.configuration.JobRegistry;
2323
import org.springframework.beans.BeansException;
2424
import org.springframework.beans.factory.annotation.Autowired;
2525
import org.springframework.context.ApplicationContext;
@@ -34,7 +34,7 @@
3434
public class JobRegistryJobParserTests implements ApplicationContextAware {
3535

3636
@Autowired
37-
private ListableJobLocator jobRegistry;
37+
private JobRegistry jobRegistry;
3838

3939
private ApplicationContext applicationContext;
4040

spring-batch-samples/src/main/java/org/springframework/batch/samples/launch/DefaultJobLoader.java

Lines changed: 4 additions & 4 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.
@@ -20,7 +20,7 @@
2020
import java.util.Map;
2121

2222
import org.springframework.batch.core.Job;
23-
import org.springframework.batch.core.configuration.ListableJobLocator;
23+
import org.springframework.batch.core.configuration.JobRegistry;
2424
import org.springframework.batch.core.launch.NoSuchJobException;
2525
import org.springframework.beans.BeanWrapperImpl;
2626
import org.springframework.beans.BeansException;
@@ -32,7 +32,7 @@
3232

3333
public class DefaultJobLoader implements JobLoader, ApplicationContextAware {
3434

35-
private ListableJobLocator registry;
35+
private JobRegistry registry;
3636

3737
private ApplicationContext applicationContext;
3838

@@ -43,7 +43,7 @@ public void setApplicationContext(ApplicationContext applicationContext) throws
4343
this.applicationContext = applicationContext;
4444
}
4545

46-
public void setRegistry(ListableJobLocator registry) {
46+
public void setRegistry(JobRegistry registry) {
4747
this.registry = registry;
4848
}
4949

spring-batch-samples/src/main/resources/org/springframework/batch/samples/misc/jmx/adhoc-job-launcher-context.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
<import resource="classpath:data-source-context.xml" />
88

9-
<bean class="org.springframework.batch.core.configuration.support.JobRegistrySmartInitializingSingleton">
10-
<property name="jobRegistry" ref="jobRegistry"/>
11-
</bean>
12-
139
<bean id="jobRepository"
1410
class="org.springframework.batch.core.repository.support.JdbcJobRepositoryFactoryBean"
1511
p:dataSource-ref="dataSource" p:transactionManager-ref="transactionManager"/>

0 commit comments

Comments
 (0)