-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The job under test should not be autowired in JobLauncherTestUtils #1237
Comments
Mariusz commented Hi, // override method with name of your job bean
@Bean
public JobLauncherTestUtils getJobLauncherTestUtils() {
return new JobLauncherTestUtils() {
@Override
@Autowired
public void setJob(@Qualifier("ncsvImportJob") Job job) {
super.setJob(job);
}
};
} |
Seems this this one is throwing a circular bean issue. Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'MYJOB': Requested bean is currently in creation: Is there an unresolvable circular reference? @SpringBatchTest
|
Petar Tahchiev opened BATCH-2366 and commented
Hello,
I have several jobs defined. Then I want to test them so I create a bean of type
JobLauncherTestUtils
inside my config:However when I run my tests I get this exception:
This is because the
JobLauncherTestUtils
thesetJob
method has the@Autowired
annotation so it will try to autowire the job, but as I said I have several.2 votes, 3 watchers
The text was updated successfully, but these errors were encountered: