【问题标题】:Is it possible to run multiple Spring Boot projects on same port?是否可以在同一个端口上运行多个 Spring Boot 项目?
【发布时间】:2016-12-03 19:45:20
【问题描述】:

是否可以通过再构建一个项目并将这些项目添加为模块并运行来在同一端口上运行多个 Spring Boot 项目。

【问题讨论】:

    标签: spring spring-boot


    【解决方案1】:

    如果你在后台使用tomcat服务器,你可以运行。

    您也可以从 application.properties 更改应用程序的端口。 对于您的情况 github.com/eugenp/spring-security-oauth ,您只需继续 https://github.com/eugenp/spring-security-oauth/blob/master/spring-security-oauth-server/src/main/resources/application.properties 并将其更改为您想要的端口

    【讨论】:

    • 谢谢@Vasile,但我没有得到“在tomcat服务器后面”,请您详细说明一下。我正在运行包装在 Spring Boot 中的 tomcat。
    • 这是您可能用于在 tomcat 上部署的设置,但由于您使用的是 Spring Boot 的包装器,我认为您无权访问它们stackoverflow.com/questions/8823290/…
    【解决方案2】:

    来自Spring Boot Guide

    如果您不小心运行了两次 Web 应用程序,您将看到“端口已在使用”错误。 STS 用户可以使用 Relaunch 按钮而不是 Run 来确保关闭任何现有实例。

    所以我猜不可能在同一个端口上运行两个启动实例。我认为不可能在同一个端口上使用多个 tomcat 服务。有关 tomcat 的讨论,请参阅 this

    【讨论】:

    • 能不能帮我跑一下github.com/eugenp/spring-security-oauth开发者要求在8081上运行,怎么可能。 @px06
    • 该存储库包含几个演示项目,您可以编译和运行其中的任何一个,因为它们的端口都已设置为8001。对于 Spring boot 项目,服务器运行端口通常在 /src/main/resources/application.properties 中定义。
    • 感谢@px06 的快速回复
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-07-19
    • 1970-01-01
    • 2019-12-25
    • 1970-01-01
    • 2016-11-08
    • 2019-10-09
    • 2020-05-17
    相关资源
    最近更新 更多