Reputation: 604
New to spring-boot, checked online examples. Got one doubt.
Main calling class
@SpringBootApplication
public class Application {
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}
Batch Processing class
@Configuration
@EnableBatchProcessing
public class BatchConfiguration {
@Autowired
public JobBuilderFactory jobBuilderFactory;
@Autowired
public StepBuilderFactory stepBuilderFactory;
--
--
so on
}
SpringApplication.run(Application.class, args)
creates an appropriate ApplicationContext instance and load beans.
I was trying to figure out that, what's a flow of code (step wise execution). Then after setting up logger at different places, figure out that BatchConfiguration
class methods are getting executed in sequence, and it covers the execution of whole code too.
Checked this class, its headed with these two tags @Configuration, @EnableBatchProcessing
. Is it correct understanding that, once SpringApplication.run
is completed, spring-boot looks for class having @Configuration, @EnableBatchProcessing
tags on it and process everything from there ? Is it a driver class ?
If above understanding is correct, how many of classes of this type (BatchConfiguration
) we can have in one spring-boot application ? If more than one, than what would be the flow then ?
Upvotes: 0
Views: 1852
Reputation: 26
Upvotes: 1
Reputation: 17854
A couple of points.
See BatchAutoConfiguration on how you can configure the behaviour of the auto-configured beans.
Upvotes: 1