Play中的配置变量!框架 [英] Configuration Variables in Play! Framework

查看:86
本文介绍了Play中的配置变量!框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Play的新手,并编写了我的第一个应用程序.此应用程序具有一组URL,它依赖于该URL,从XML中提取数据并还返回XML响应上的有效URL.

I am new to Play!, and wrote my first application. This app has a set of URL's it depends of, to pull data from and also to return valid URLs on the XML responses.

此应用程序需要在不同的环境(Dev,Staging和Prod)中运行,并且每种环境都需要自己的一组URL.

This app needs to run in different environments (Dev, Staging and Prod), and each environment will require its own set of URLs.

我想定义这组URL的位置在application.conf文件中.但是我似乎不知道如何操作,后来又通过普通的类访问它们.

I guess the place to define this set of URLs is in the application.conf file. However I don't seem to find out how, and later access them through the normal classes.

相关的一点是,我不想使用Framework ID,因为我们会将其部署为WAR,并且在每个环境中拥有aplication.conf文件的实例会更容易.

As a related point, I don't want to use Framework IDs as we will deploying this as a WAR, and it will be easier to have an instance of the aplication.conf file per environment.

推荐答案

查看此帖子-采用该文章中的方法,而不是使用Play.mode.isDev(),而是使用配置,例如Play.configuration.get('item-from-app-conf')

Take the approach in that post, but rather than using Play.mode.isDev(), use the configuration, such as Play.configuration.get('item-from-app-conf')

这篇关于Play中的配置变量!框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆