import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@Component
@Order(value = 1) //使用@Order做优先级调整,按照value值从小到大,优先级从高到低
public class demo implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
// TODO
}
}
让springboot在启动后做某些操作:实现CommandLineRunner,重写run方法
最新推荐文章于 2024-03-30 14:41:40 发布