Interface CommandLineRunner


public interface CommandLineRunner

A bean that runs once the server is accepting, with the program's command-line arguments, as Spring Boot's does.

Every such bean runs in the order of its @Order, together with the ApplicationRunner beans, before ApplicationReadyEvent is sent. One that throws stops the server, so a start-up task that fails fails the start.

@Component
public class Seed implements CommandLineRunner {
    public void run(String... args) {
        // ...
    }
}
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run(String... args)
    Runs the task.
  • Method Details

    • run

      void run(String... args) throws Exception
      Runs the task.
      Parameters:
      args - the arguments the program was started with
      Throws:
      Exception