感性饼干

文章
5
资源
0
加入时间
3年11月9天

SpringBoot之CommandLineRunner

当我们使用SpringBoot构建项目时,经常会经常会预先加载一些数据,这时就可以使用CommandLineRunner接口。当有多个这样的类来加载数据时,@Order注解中的数字代表加载的顺序,数字越小的先加载。@Component@Order(1)public class MyStartupRunner implements CommandLineRunner { @Override public void run(String... args) throws Exce