CommandLineRunner接口

一、首先创建一个MyCommandLineRunner类实现CommandLineRunner接口

   

  ApplicationRunner文章

  https://www.cnblogs.com/fernfei/p/12090764.html

@Commponent把pojo注册到spring容器中

@Order(2)这个数越小优先级越前

   

二、重写run()函数

   

args是系统启动时所传入的参数

   

   

   

   

三、传入参数

1、IDEA中传入参数

   

   

2、打包运行时传入参数

   

   

三、效果图

   

   

   

原文地址:https://www.cnblogs.com/fernfei/p/12090763.html