I have created a maven module for implementing spring batch in our project. My aim is to export data from database table to CSV file (basing on a repository implemented in another maven module).
In my Spring boot main class I have the following:
@SpringBootApplication(scanBasePackages = {"com.test"})
@ComponentScan({"com.test"})
public class MainBatchApplication {
public static void main(String args []){
SpringApplication.run(MainBatchApplication.class,args);
}
}
The package com.test
is the path of our implemented UserRepository I want to use to get all users from database.
Once I inject the UserRepository in my Spring Batch created maven module and once I run the spring boot app. I got the following error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'batchConfiguration': Unsatisfied dependency expressed through field 'userRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.test.repositories.UserRepository.getFilteredByMonth(java.lang.String,java.util.Date,java.util.Date)!
The module where com.test
if included in my batch maven module as dependency (pom.xml)