springboot 启动完成后自动打开浏览器跳到当前项目的登录界面。

@SpringBootApplication()
public class Application {

public static void main(String[] args) {

int port = 80;
String portPrefix = "--server.port=";
for (String arg : args)
{
if (arg.startsWith(portPrefix)) {
port = Integer.parseInt(arg.substring(portPrefix.length()));
}
}
SpringApplication.run(Application.class, args);
try {
Runtime.getRuntime().exec("cmd /c start http://localhost:" + port+"/xxx");
} catch (Exception e) {
e.printStackTrace();
}


}

}