🎀springboot 项目启动自动打开浏览器访问网站设置

💖简介

Springboot 项目启动自动打开浏览器访问网站设置

📖环境

windows

🌟实现

在需要打开网址的地方添加:

// 启动打开默认浏览器访问
try {
    Runtime.getRuntime().exec("cmd /c start http://localhost:8080/");
} catch (Exception e) {
    e.printStackTrace();
}

其中网站修改为自己网址

🔧使用

当我们使用springboot+vue开发了本地使用插件时,可以在项目启动时,直接打开浏览器相应网址,给予用户可视化页面

springboot打包jarexe启动操作可以看我另一博客:
springboot项目打包jar 并打包为exe启动

---结束

posted @ 2021-11-16 18:23  丿似锦  阅读(3296)  评论(1)    收藏  举报