Skip to the content.

Home / cs-notes / Architecture / Components / Spring / Boot / Start / Runner / CommandLineRunner

public interface CommandLineRunner
{
    /**
     * Callback used to run the bean.
     * @param args incoming main method arguments
     * @throws Exception on error
     */
    void run (String... args)throws Exception;
}
@Component
public class MyBean implements CommandLineRunner
{
    public void run(String... args)
    {
        // Do something...
    }
}
@Bean
public
CommandLineRunner init()
{
    return (String... strings) -> {

    };
}