java - 在tomcat中外部化application.properties的问题
问题描述
我有一个带有活动配置文件阶段的成绩项目(application-satge.properties)。如何从项目外部配置此文件。War 部署在 tomcat 的 /webapps 文件夹中,因此我可以进行更改,因为项目中没有使用 CI/CD。
**.properties 项目中的文件
- application.properties -> 有 spring.profiles.active=stage 2.application-stage.properties
我尝试将此内容作为 context.xml 放入 tomcat/conf/catalina/localhost
<Context>
<Resources>
<PreResources className="org.apache.catalina.webresources.FileResourceSet"
base="apache-tomcat-8.5.65/webapps/application-stage.properties"
webAppMount="/WEB-INF/classes/application-stage.properties" />
</Resources>
</Context>
任何建议请我的路径出错了吗?
解决方案
推荐阅读
- sql-server - 尝试将 CTE 用于 IF
- elasticsearch - 用于预置 Elastic Search 的 AWS Cloud Formation 模板
- python - 如果有超过 2 个字段为空,则跳过该行
- c - 此函数返回一个列表,其中包含列表“A”中“pos_list”中给定位置的值
- javascript - 删除用户的个人资料
- microsoft-cognitive - 有人知道 QNA 制造商 CORS 设置吗?
- react-native - React 本机 webview 文件未在 ios 设备中加载,但在模拟器中加载正常
- c - 我正在尝试解决这个问题,我曾尝试过,但我不知道如何通过代码或逻辑方式解决此问题
- c# - 实体框架:脚手架时删除两个方向导航
- javascript - 如何在反应中了解客户端是 env prod 或 staging