Spring Boot Tutorials
- Spring Boot ApplicationRunner
Spring Boot has two runners, CommandLineRunner
and ApplicationRunner
with the difference that CommandLineRunner
accepts arguments as string array whereas ApplicationRunner
accepts arguments as ApplicationArguments
. Both are functional interface with a method named as run
.
- Spring Boot CommandLineRunner
Spring CommandLineRunner
is a functional interface. The beans created by implementing this interface, run before application startup. It is useful to process some data before application startup. We can create multiple beans using CommandLineRunner
and their order can be decided using Ordered
interface or @Order
annotation.