在启动类中添加监听时间
@EventListener({ApplicationReadyEvent.class})
public void applicationReadyEvent() {
System.out.println("应用已经准备就绪,正在启动浏览器");
String url = "http://localhost:7000";
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec("rundll32 url.dll,FileProtocolHandler " + url);
} catch (IOException e) {
e.printStackTrace();
}
}

//服务器终止监听
@EventListener({ContextClosedEvent.class})
public void applicationExitEvent() {
System.out.println("应用终止");
}

相关文章:

  • 2021-12-28
  • 2021-08-08
  • 2021-11-08
  • 2021-11-27
  • 2021-04-04
  • 2021-12-13
  • 2021-09-08
  • 2021-05-24
猜你喜欢
  • 2021-07-09
  • 2021-06-19
  • 2022-12-23
  • 2021-12-19
  • 2021-12-19
相关资源
相似解决方案