Spring .properties 文件位于类路径中
如果我这样做
<value>classpath:site/properties/default/placeholder.properties</value>
classpath:
实际意味着什么?这是否意味着我的属性文件需要位于不易更新的位置?我希望 .properties 文件位于网站管理员可以根据需要动态更改设置的位置。您仍然可以使用位于类路径中的 .properties 文件来执行此操作吗:?
If I do
<value>classpath:site/properties/default/placeholder.properties</value>
What does the classpath:
actually mean? Does that mean my properties file needs to be in a place that won't be easily updateable? I would like a .properties file to be in a location where a webmaster can change settings on the fly if needed. Can you still do that with a .properties file located in the classpath:?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
classpath:
指向位于classes
目录中的文件。换句话说,您的placeholder.properties
位于/site/properties/default
目录中。我不认为网站管理员在部署项目后就可以动态更改设置,我的意思是,您可以更改它,但它可能根本不会生效。classpath:
points to files located in theclasses
directory. In other words, yourplaceholder.properties
is located in<classes-dir>/site/properties/default
directory. I don't think the webmaster is allowed to change the settings on the fly once you deployed the project, I mean, you could change it, but it probably won't take effect at all.