在 java 中加载 Web 应用程序特定配置和设置的首选方法是什么
我想知道您在 Web 应用程序中加载应用程序设置的常用方法是什么。我只是环顾四周,因为我只需要一次,并且我们要求用户指定环境变量,并将路径设置为我们在 spring 上下文中加载的配置文件。我的观点不是加载(无论是xml还是属性)而是文件的位置和定位,您认为首选方式是什么。
问候,
马雷克
I was wondering what is the usual way for you to load application settings in web applications. I'm just looking around because I had only needed this once and we required user to specify environment variable with path set to the configuration file which we loaded in the spring context. My point is not the loading (whether xml or properties) but the location and locating of the file, what do you think is the preferred way.
Regards,
Marek
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将
properties
文件放在用户主目录中是一个不错的选择Placing
properties
file in User's home directory is a good option这取决于情况,但将设置存储在本地属性文本文件中或数据库表中是两种常见的方法。
It depends, but storing settings either in a properties text file locally, or in a database table are two common ways.
我们通常在上下文描述符中填充 JNDI 环境。
We usually populate the JNDI environment in the context descriptor.