How to Use CommandLineRunner in Spring Boot Application

package com.therealdanvega;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
 
@Component
public class DataLoader implements CommandLineRunner {
 
    private final Logger logger = LoggerFactory.getLogger(DataLoader.class);
 
    @Override
    public void run(String... strings) throws Exception {
        logger.info("Loading data...");
 
    }
}

References
https://www.quickprogrammingtips.com/spring-boot/how-to-use-commandlinerunner-in-spring-boot-application.html
http://therealdanvega.com/blog/2017/04/07/spring-boot-command-line-runner