实现CommandLineRunner的接口中的run方法会在springboot启动时自动运行
@Component
public class testThread implements CommandLineRunner {
//todo
@Override
public void run(String... args) throws Exception {
System.out.println("springboot starting");
while (true) {
Thread.sleep(1000);
System.out.println("The Runner start to initialize ...");
}
}
}