I only use annotation driven configuration, no XML hell, including a spring batch application into my spring mvc rest based application.
The spring-batch configuration file starts like this:
@Configuration
@EnableBatchProcessing
public class BatchConfig {
@Autowired
JobBuilderFactory jobBuilderFactory;
@Autowired
StepBuilderFactory stepBuilderFactory;
[...]
IntelliJ puts a mark on those beans, telling me it could not autowire as no beans of 'JobBuilderFactory' / 'StepBuilderFactory' type were found. AFAIK the annotation @EnableBatchProcessing should make those beans available.
The application does compile, so spring-batch seems to be included. In my pom.xml I added
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>
I can autowire other beans (private Environment environment) in the same file, so autowiring itself works. Which steps do i need to find the solution? Could it only be an Intellij issue as it compiles?
EnableBatchProcessing annotation need to be added along with @Configration
@Configuration
@EnableBatchProcessing
public class BatchConfiguration {
@Autowired
public JobBuilderFactory jobBuilderFactory;
@Autowired
public StepBuilderFactory stepBuilderFactory;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With