Spring Boot 2.0 Cookbook(Second Edition)
上QQ阅读APP看书,第一时间看更新

Using the command-line runners

With our basic application skeleton ready, let's add some meat to the bones by making our application do something.

Let's start by first creating a class named StartupRunner. This will implement the CommandLineRunner interface, which basically provides just one method: public void run(String... args) --that will get called by Spring Boot only once after the application has started.