Я работаю над образцом, чтобы продемонстрировать модульное тестирование с помощью пружинной партии.Во время сборки maven я мог видеть, что модульный тест выполнен успешно, но сборка все еще не выполняется с ошибкой ниже.
Пакетный тест успешно выполнен.Ниже приведен вывод
2019-09-29 16:30:43.276 INFO 8065 --- [ main] o.s.b.a.b.JobLauncherCommandLineRunner : Running default command line with: []
2019-09-29 16:30:43.402 INFO 8065 --- [ main] o.s.b.c.l.support.SimpleJobLauncher : Job: [SimpleJob: [name=transactionProcessingJob]] launched with the following parameters: [{}]
2019-09-29 16:30:43.434 INFO 8065 --- [ main] o.s.batch.core.job.SimpleStepHandler : Executing step: [transactionImportStep]
Hibernate: call next value for transaction_entry_seq
Hibernate: call next value for transaction_entry_seq
Hibernate: insert into transaction_entry (account_no, amount, transaction_date, transaction_type, id) values (?, ?, ?, ?, ?)
Hibernate: insert into transaction_entry (account_no, amount, transaction_date, transaction_type, id) values (?, ?, ?, ?, ?)
Hibernate: insert into transaction_entry (account_no, amount, transaction_date, transaction_type, id) values (?, ?, ?, ?, ?)
Hibernate: insert into transaction_entry (account_no, amount, transaction_date, transaction_type, id) values (?, ?, ?, ?, ?)
Hibernate: insert into transaction_entry (account_no, amount, transaction_date, transaction_type, id) values (?, ?, ?, ?, ?)
Hibernate: insert into transaction_entry (account_no, amount, transaction_date, transaction_type, id) values (?, ?, ?, ?, ?)
Hibernate: insert into transaction_entry (account_no, amount, transaction_date, transaction_type, id) values (?, ?, ?, ?, ?)
Hibernate: insert into transaction_entry (account_no, amount, transaction_date, transaction_type, id) values (?, ?, ?, ?, ?)
Hibernate: insert into transaction_entry (account_no, amount, transaction_date, transaction_type, id) values (?, ?, ?, ?, ?)
2019-09-29 16:30:43.696 INFO 8065 --- [ main] o.s.b.c.l.support.SimpleJobLauncher : Job: [SimpleJob: [name=transactionProcessingJob]] completed with the following parameters: [{}] and the following status: [COMPLETED]
После выполнения текстового блока сборка завершается с ошибкой ниже
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.batch.test.JobLauncherTestUtils' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1658) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1217) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1171) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] ... 31 common frames omitted
Полный исходный код примера доступен здесь