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


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

在启动类中添加:

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

其中网站修改为自己网址

该操作用途:

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

springboot打包jar转exe启动操作可以看我另一博客:


结束