1. Home
  2. Docs
  3. java
  4. spring boot

spring boot

Spring Boot 初始化运行特定方法

/**
 * 初始化类
 */
@Order(1) // @Order注解可以改变执行顺序,越小越先执行
@Component
public class MyApplicationRunner1 implements ApplicationRunner {

    /**
     * 会在服务启动完成后立即执行
     */
    @Override
    public void run(ApplicationArguments arg0) throws Exception {
        System.out.println("MyApplicationRunner1----" + arg0);
    }

}

资料-Spring Boot 初始化运行特定方法

相关资料

spring-boot中文文档

springboot-参考项目

Articles

Was this article helpful to you? Yes No

How can we help?