Spring Boot CommandLineRunner example:
import org.springframework.boot.CommandLineRunner;
@SpringBootApplication
public class StartBookApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(StartBookApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
System.out.println("run any method here >>> ");
//run any method here >>>
}
}