只需要寫(xiě)一個(gè)類繼承CommandLineRunner然后實(shí)現(xiàn)run方法,run方法即會(huì)在此項(xiàng)目啟動(dòng)時(shí)執(zhí)行
package com.jerry.work.runner;
import com.jerry.work.reminder.Reminder;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
*
*/
@Component
@Order(value=1)
public class StartupRunner implements CommandLineRunner
{
@Override
public void run(String... args) throws Exception
{
System.out.println("啟動(dòng)springboot");
}
}