哪个网站上可以做代打,seo关键词推广公司,广西住房城乡建设厅官方网站,河北邢台区号如果希望在SpringBoot应用启动时进行一些初始化操作可以选择使用CommandLineRunner来进行处理。
我们只需要实现CommandLineRunner接口#xff0c;并且把对应的bean注入容器。把相关初始化的代码重新到需要重新的方法中。
这样就会在应用启动的时候执行对应的代码。
Compon…如果希望在SpringBoot应用启动时进行一些初始化操作可以选择使用CommandLineRunner来进行处理。
我们只需要实现CommandLineRunner接口并且把对应的bean注入容器。把相关初始化的代码重新到需要重新的方法中。
这样就会在应用启动的时候执行对应的代码。
Component
public class TestRunner implements CommandLineRunner {Overridepublic void run(String... args) throws Exception {System.out.println(程序初始化);}
}