1

我可以像这样使用 playframework1.2.7 在 applicaton.conf 中设置 http.port

http.port = 9020
jpda.port = 8020

还有 jdpa.port。

但是在play2.4中。

我不能http.port像这样在 application.conf 中设置。

我知道当我运行这个项目时我可以这样做。

activator "run 9020"

但这对我来说太麻烦了。

如果你有一些想法,请分享你的想法。

4

1 回答 1

1

在运行模式期间,您不能在 aaplication.conf 中指定端口(但这可以在部署时使用)。

在运行模式下,Play 的 HTTP 服务器部分在应用程序编译之前启动。这意味着 HTTP 服务器在启动时无法访问 application.conf 文件。如果您想在使用 run 命令时覆盖 HTTP 服务器设置,则不能使用 application.conf 文件。相反,您需要使用系统属性或上面显示的 devSettings 设置。

来源:https ://www.playframework.com/documentation/2.4.x/Configuration#HTTP-server-settings-in-application.conf

另请查看完整的服务器配置选项
https://www.playframework.com/documentation/2.4.x/ProductionConfiguration#Server-configuration-options

于 2015-07-16T08:35:58.430 回答