如何指定Play框架以使用其他路径文件

时间:2013-11-21 20:45:09

标签: playframework playframework-2.0

我知道我可以使用-Dconfig.file标志让Play服务器使用不同的application.conf文件。

有没有办法同时指定服务器使用不同的路由文件?

1 个答案:

答案 0 :(得分:5)

您可以在application.conf中设置它或使用JVM标志

-Dapplication.router=my.application.Routes

https://github.com/playframework/playframework/blob/2.2.1/framework/skeletons/java-skel/conf/application.conf#L20

# Router
# ~~~~~
# Define the Router object to use for this application.
# This router will be looked up first when the application is starting up,
# so make sure this is the entry point.
# Furthermore, it's assumed your route file is named properly.
# So for an application router like `conf/my.application.Router`,
# you may need to define a router file `my.application.routes`.
# Default to Routes in the root package (and `conf/routes`)
# application.router=my.application.Routes