Spring-boot-runners
提供:Dev Guides
春のブーツ-ランナー
Application Runner and Command Line Runner interfaces lets you to execute the code after the Spring Boot application is started. You can use these interfaces to perform any actions immediately after the application has started. This chapter talks about them in detail.
アプリケーションランナー
Application Runnerは、Spring Bootアプリケーションの起動後にコードを実行するために使用されるインターフェイスです。 以下の例は、メインクラスファイルにApplication Runnerインターフェースを実装する方法を示しています。
ここで、* Application Runnerの Hello World の下のコンソールウィンドウを観察すると、Tomcatの起動後にprintlnステートメントが実行されます。 次のスクリーンショットは関連していますか?
Hello World From Application Runner
コマンドラインランナー
コマンドラインランナーはインターフェースです。 Spring Bootアプリケーションの起動後にコードを実行するために使用されます。 以下の例は、メインクラスファイルにコマンドラインランナーインターフェイスを実装する方法を示しています。
Tomcatの起動後にprintlnステートメントが実行される「コマンドラインランナーのHello world」の下のコンソールウィンドウを見てください。