SpringBoot 设置服务一启动就执行、初始化数据
时间:2021-07-12 17:55:04
收藏:0
阅读:0
定义一个类实现ApplicationRunner
接口,然后Override这个ApplicationRunner
接口的run方法
@Component public class TaskRunner implements ApplicationRunner { public static final Logger log = LoggerFactory.getLogger(TaskRunner.class); @Override public void run(ApplicationArguments args) throws Exception { //初始化 } }
评论(0)