ven*_*t g 4 spring spring-mvc spring-boot
我们正在将Spring Boot应用程序作为后台进程运行,因此我们无权访问启动日志,是否有办法知道启动启动过程完成之后?
您可以选择在Spring Boot进程启动完成后执行一些代码,启动完成后,您可以发送有关启动完成的通知。
@SpringBootApplication
@Component
public class Application implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Override
public void run(String... arg0) throws Exception {
// You can write your code here.
// This code will be executed after Spring Boot Startup completed.
}
}
Run Code Online (Sandbox Code Playgroud)
只需实现上面所示的CommandLineRunner。
| 归档时间: |
|
| 查看次数: |
1230 次 |
| 最近记录: |