j2ee web 应用程序的应用程序特定的 config/properties/APP_HOME 放在哪里?
#1 - 存储 Web 应用程序配置(在应用程序重新启动和重新部署后需要保留)的通用位置在哪里?它必须位于 Web 应用程序目录之外的某个位置,以避免在部署新战争时被覆盖。我发现的一个例子是始终使用 $HOME/.my_app_name 作为启动 Web 容器的用户,但如果用户发生更改怎么办?所有配置都会丢失。
#2 - 如果我的网络应用程序是动态的,那么通知该位置的常用方法是什么?
这是我能够找到的唯一示例,但我还没有找到任何正式的说明来说明这是标准的。 http://wiki.hudson-ci.org/display/HUDSON/Administering+Hudson
#1 - Where is the common location for storing web app configuration that needs to persist after the app is restarted and redeployed? It must be somewhere outside the web app's directory in order to avoid being overwritten when a new war is deployed. One example I have found is to always use $HOME/.my_app_name for the user that started web container, but what if the user changes? All configuration would be lost.
#2 - What is the common way to inform my webapp of this location if it is dynamic?
This is the only example I have been able to find, but I have not found any formal instructions for this being standard. http://wiki.hudson-ci.org/display/HUDSON/Administering+Hudson
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我理解它需要可写?所以类路径是没有问题的。
提供路径作为 JVM 启动参数:
这样可以通过 System#getProperty() 来获取它。
在您的网络应用程序的安装/使用手册中正确记录它。相应地实现您的代码,只要该属性丢失或路径不存在或不可写,它就会抛出一个清晰的运行时异常,以便系统管理员可以轻松修复它。
I understand that it needs to be writable? So the classpath is out of question.
Provide the path as a JVM startup argument:
This way it's available by
System#getProperty()
.Document it properly in the installation/usage manual of your webapp. Implement your code accordingly that it throws a crystal clear runtime exception whenever that property is missing or that the path does not exist or is not writable so that it can easily be fixed by the sysadmin.