是否可以通过从属性文件中获取值来设置 Tomcat 的 web.xml 中的值?
例如我想在属性文件中外部化用户角色设置,是否可以这样做:
我的属性文件:
#properties file
my.user.role=role1
我的 web.xml:
<security-role>
<role-name>${my.user.role}</role-name>
</security-role>
编辑:
我找到了 this帖子,所以我想角色需要在 web.xml 中设置为静态。
最佳答案
您可以访问系统环境变量。另见 this发布。
关于tomcat - web.xml:从属性文件设置值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6148141/