接口 CommandLineRunner

函数接口:
这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

@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.

从以下版本开始:
1.0.0
作者:
Dave Syer
另请参阅:
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    run(String... args)
    Callback used to run the bean.
  • 方法详细资料

    • run

      void run(String... args) throws Exception
      Callback used to run the bean.
      参数:
      args - incoming main method arguments
      抛出:
      Exception - on error