spring - 如何使用 Spring Boot 自动释放 8080 端口
问题描述
我正在运行基本的 Spring Boot MVC 应用程序,并且在每次应用程序重新启动时,我必须手动关闭端口 8080,否则 Spring Boot 应用程序将无法运行它给出了这个错误:
Execution failed for task ':DemoApplication.main()'.
> Process 'command 'C:/Program Files/Java/jdk-11.0.3/bin/java.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Tomcat不应该在应用关闭后立即关闭并释放8080端口吗?
解决方案
在 IntelliJ 中,转到 Run / Edit Configurations... / Tomcat Server / Local / Shutdown script ans 指定用于释放端口的脚本。
或者,您可以编辑原始 Tomcat 配置,例如在 处,如下所示d:\dev\apache-tomcat-8.0.36\conf\server.xml
:<Server port="8080" shutdown="SHUTDOWN">
推荐阅读
- r - 一旦放入数据框中,日期就会神秘地转换为数字数据
- flutter - Flutter 像画布一样渲染到屏幕上。我如何实现这种布局?
- python - Flask_mail 连接被拒绝
- android - 二进制 XML 文件错误膨胀 RecyclerView
- android - 从设备上卸载我的应用程序使我无法再从 Android Studio 运行它
- javascript - 如何在打字稿中将这些对象转换为数组
- testing - Kotlin 测试类应该是内部的吗?
- spreadsheet - 如何在 Google 电子表格中永久隐藏可旋转的编辑器框?
- three.js - 在 Three.js 点云中显示深度
- laravel - 从所见即所得编辑器呈现值时编译模板意外标识符时出错