SpringBoot的CommandLineRunner接口,作为SpringBoot启动后的接口回调。可以将系统一些数据初始化,放入其中;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@Order(1)
@Component
public class Demo2 implements CommandLineRunner {
@Override
public void run(String... var1) throws Exception {
System.out.println("2");
}
}