org.springframework.boot

Interface CommandLineRunner

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.


    @FunctionalInterface
    public interface CommandLineRunner
    Interface used to indicate that a bean should run when it is contained within a SpringApplication. Multiple CommandLineRunner beans can be defined within the same application context and can be ordered using the Ordered interface or @Order annotation.

    If you need access to ApplicationArguments instead of the raw String array consider using ApplicationRunner.

    Since:
    1.0.0
    See Also:
    ApplicationRunner
    • Method Detail

      • run

        void run(java.lang.String... args)
          throws java.lang.Exception
        Callback used to run the bean.
        Parameters:
        args - incoming main method arguments
        Throws:
        java.lang.Exception - on error