[英]How can I specify a default value for a system property in a Java web app?
It seems like this should be so easy, but I have been banging my head on it for days. 似乎这应该很容易,但是我已经为此努力了好几天。
I have a simple Java web app that uses Jetty embedded in an executable jar, and I am using system properties to define configuration info that I'm keeping separated from the app. 我有一个简单的Java Web应用程序,该应用程序使用嵌入在可执行jar中的Jetty,并且正在使用系统属性来定义与应用程序保持分离的配置信息。 I like that I can set system properties on the command line with -D
. 我喜欢这样,我可以在命令行上使用-D
设置系统属性。 For example, 例如,
java -Dbackend=backend_url -jar ...
Is there a way to set a default value for such a system property? 有没有办法为这样的系统属性设置默认值?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.