参考: https://www.cnblogs.com/chenmc/p/9253230.html
1、 创建自定义类实现 CommandLineRunner接口,重写run()方法。springboot启动之后会默认去扫描所有实现了CommandLineRunner的类,并运行其run()方法。
2、创建自定义类实现ApplicationRunner 接口,重写run()方法。
关于二者的区别:
其实并没有什么区别,如果想获取更加详细的参数的时候,可以选择使用ApplicationRunner接口。其参数类型为:ApplicationArguments 。