其他分享
首页 > 其他分享> > CommandLineRunner接口

CommandLineRunner接口

作者:互联网

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

   

@Commponent把pojo注册到spring容器中

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

   

二、重写run()函数

   

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

   

   

   

   

三、传入参数

1、IDEA中传入参数

   

   

2、打包运行时传入参数

   

   

三、效果图

   

   

   

标签:Commponent,CommandLineRunner,系统启动,传入,接口,参数
来源: https://www.cnblogs.com/fernfei/p/12090763.html