Spring Boot Application CommandLineRunner

Sometimes, it is useful to run a command after the Spring Application starts. This can be achieved by implementing the CommandLineRunner and overriding the run method. An example is below.

public class ExampleCLRApplication implements CommandLineRunner {
  public static void main(String[] args) {
    SpringApplication.run(OrgServiceAdapterApplication.class, args);

  public void run(String... args) throws Exception {

Leave a Reply

Your email address will not be published.