编写一个类实现CommandLineRunner接口,重写它的run方法
@Slf4j
@Component
public class CommandRunnerUtil implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
log.info("start gateway list throw calue init .....");
log.info("gateway list init finish .....");
}
}
就可以实现springboot在项目启动后自定义初始化系统资源。