CommandLineRunner

SpringBoot提供的一个CommandLineRunner接口,经过实现该接口能够在项目启动后执行指定任务,若是须要按照必定的顺序去执行,就须要在实体类上使用一个@Order注解,值越小优先级越高。 应用场景如:加载字典到缓存web @Component @Order(0) public class StartupRunner2 implements CommandLineRunner {
相关文章
相关标签/搜索