简体   繁体   English

spring-boot webapp准备好后如何让Intellij自动启动浏览器

[英]How to get Intellij to launch browser automatically after spring-boot webapp is ready

I just switched a Spring Boot webapp from an external war deploy in Tomcat to a direct jar deploy with Spring Boot (and its internal Tomcat).我刚刚将 Spring Boot webapp 从 Tomcat 中的外部战争部署切换到使用 Spring Boot(及其内部 Tomcat)的直接 jar 部署。

For Tomcat Run/Debug Configurations, Intellij gives you the to open browser after launch and go to http://localhost:8080/ .对于 Tomcat 运行/调试配置,Intellij 为您提供启动后打开浏览器并转到http://localhost:8080/ 的选项

How can I do something similar with aa Spring Boot RUn/Debug Configuration.如何使用 Spring Boot 运行/调试配置做类似的事情。 It runs the main class and just waits until I go to localhost:8080 from the browser myself.它运行主类,直到我自己从浏览器转到 localhost:8080。

edit your run/debug configurations in the bottom - click on '+' right above 'Build' select 'launch web browser', put your app url, for example http://localhost:8181在底部编辑您的运行/调试配置 - 单击“构建”正上方的“+”,选择“启动 Web 浏览器”,输入您的应用程序 URL,例如http://localhost:8181 在此处输入图片说明

so you will have所以你会有在此处输入图片说明

click apply/ok, with that when you click Run/play button, it will launch browser with your url after the build单击应用/确定,当您单击运行/播放按钮时,它将在构建后使用您的 url 启动浏览器

It doesn't seem like there is a way to do this.似乎没有办法做到这一点。 You can only launch external commands before launch it seems.您只能在启动之前启动外部命令。 Alternatively, you could try something like this in code as explained here .或者,您可以按照此处的说明在代码中尝试类似的操作。

我知道如何做到这一点的唯一方法是进行 Tomcat 服务器运行配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM