I modified the DataSource and created Job Repository bean as you suggest, and I was able to advance, that exception disappeared, but I got the exception below.
. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )__ | '_ | '| | ' / ` | \ \ \
\/ __)| |)| | | | | || (| | ) ) ) )
' || .__|| ||| |_, | / / / /
=========||==============|/=////
:: Spring Boot :: (v3.2.10)
2024-11-01T16:08:47.115-04:00 INFO 20812 --- [ main] c.e.b.BatchProcessingApplication : Starting BatchProcessingApplication using Java 22 with PID 20812 (D:\User\Gilmar\git-repo\spring-batch-mastery\spring-batch-initial\target\classes started by Gilmar in D:\User\Gilmar\git-repo\spring-batch-mastery\spring-batch-initial) 2024-11-01T16:08:47.117-04:00 INFO 20812 --- [ main] c.e.b.BatchProcessingApplication : No active profile set, falling back to 1 default profile: "default" 2024-11-01T16:08:47.804-04:00 WARN 20812 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'batchConfiguration' of type [com.example.batchprocessing.BatchConfiguration$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [jobRegistryBeanPostProcessor] is declared through a non-static factory method on that class; consider declaring it as static instead. 2024-11-01T16:08:47.828-04:00 WARN 20812 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'jobRegistry' of type [org.springframework.batch.core.configuration.support.MapJobRegistry] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [jobRegistryBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies. 2024-11-01T16:08:47.898-04:00 INFO 20812 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2024-11-01T16:08:48.361-04:00 INFO 20812 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@150ede8b 2024-11-01T16:08:48.364-04:00 INFO 20812 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2024-11-01T16:08:48.387-04:00 INFO 20812 --- [ main] c.e.batchprocessing.BatchConfiguration : jobTemplate running 2024-11-01T16:08:48.402-04:00 INFO 20812 --- [ main] c.e.batchprocessing.BatchConfiguration : FlatFileItemReader 2024-11-01T16:08:48.418-04:00 INFO 20812 --- [ main] c.e.batchprocessing.BatchConfiguration : PersonItemProcessor 2024-11-01T16:08:48.438-04:00 INFO 20812 --- [ main] c.e.batchprocessing.BatchConfiguration : JdbcBatchItemWriter 2024-11-01T16:08:48.461-04:00 INFO 20812 --- [ main] o.s.b.c.r.s.JobRepositoryFactoryBean : No database type set, using meta data indicating: MYSQL 2024-11-01T16:08:48.518-04:00 INFO 20812 --- [ main] c.e.batchprocessing.BatchConfiguration : step1 2024-11-01T16:08:48.577-04:00 INFO 20812 --- [ main] c.e.batchprocessing.BatchConfiguration : importUserJob 2024-11-01T16:08:48.602-04:00 WARN 20812 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobExplorer' defined in class path resource [com/example/batchprocessing/BatchConfiguration.class]: Failed to instantiate [org.springframework.batch.core.explore.JobExplorer]: Factory method 'jobExplorer' threw exception with message: To use the default configuration, a data source bean named 'dataSource' should be defined in the application context but none was found. Override getDataSource() to provide the data source to use for Batch meta-data. 2024-11-01T16:08:48.603-04:00 INFO 20812 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2024-11-01T16:08:48.616-04:00 INFO 20812 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. 2024-11-01T16:08:48.625-04:00 INFO 20812 --- [ main] .s.b.a.l.ConditionEvaluationReportLogger :
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2024-11-01T16:08:48.655-04:00 ERROR 20812 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobExplorer' defined in class path resource [com/example/batchprocessing/BatchConfiguration.class]: Failed to instantiate [org.springframework.batch.core.explore.JobExplorer]: Factory method 'jobExplorer' threw exception with message: To use the default configuration, a data source bean named 'dataSource' should be defined in the application context but none was found. Override getDataSource() to provide the data source to use for Batch meta-data. at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648) ~[spring-beans-6.1.13.jar:6.1.13] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:485) ~[spring-beans-6.1.13.jar:6.1.13] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1355) ~[spring-beans-6.1.13.jar:6.1.13] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1185) ~[spring-beans-6.1.13.jar:6.1.13] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562) ~[spring-beans-6.1.13.jar:6.1.13] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.13.jar:6.1.13] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) ~[spring-beans-6.1.13.jar:6.1.13] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.13.jar:6.1.13] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) ~[spring-beans-6.1.13.jar:6.1.13] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.13.jar:6.1.13] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[spring-beans-6.1.13.jar:6.1.13] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:971) ~[spring-context-6.1.13.jar:6.1.13] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625) ~[spring-context-6.1.13.jar:6.1.13] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.10.jar:3.2.10] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.10.jar:3.2.10] at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.2.10.jar:3.2.10] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.2.10.jar:3.2.10] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.2.10.jar:3.2.10] at com.example.batchprocessing.BatchProcessingApplication.main(BatchProcessingApplication.java:11) ~[classes/:na] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.explore.JobExplorer]: Factory method 'jobExplorer' threw exception with message: To use the default configuration, a data source bean named 'dataSource' should be defined in the application context but none was found. Override getDataSource() to provide the data source to use for Batch meta-data. at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:178) ~[spring-beans-6.1.13.jar:6.1.13] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644) ~[spring-beans-6.1.13.jar:6.1.13] ... 18 common frames omitted Caused by: org.springframework.batch.core.configuration.BatchConfigurationException: To use the default configuration, a data source bean named 'dataSource' should be defined in the application context but none was found. Override getDataSource() to provide the data source to use for Batch meta-data. at org.springframework.batch.core.configuration.support.DefaultBatchConfiguration.getDataSource(DefaultBatchConfiguration.java:250) ~[spring-batch-core-5.1.2.jar:5.1.2] at org.springframework.batch.core.configuration.support.DefaultBatchConfiguration.jobExplorer(DefaultBatchConfiguration.java:172) ~[spring-batch-core-5.1.2.jar:5.1.2] at com.example.batchprocessing.BatchConfiguration$$SpringCGLIB$$0.CGLIB$jobExplorer$21() ~[classes/:na] at com.example.batchprocessing.BatchConfiguration$$SpringCGLIB$$FastClass$$1.invoke() ~[classes/:na] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:348) ~[spring-context-6.1.13.jar:6.1.13] at com.example.batchprocessing.BatchConfiguration$$SpringCGLIB$$0.jobExplorer() ~[classes/:na] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146) ~[spring-beans-6.1.13.jar:6.1.13] ... 19 common frames omitted