首页 > 解决方案 > 在tomcat中外部化application.properties的问题

问题描述

我有一个带有活动配置文件阶段的成绩项目(application-satge.properties)。如何从项目外部配置此文件。War 部署在 tomcat 的 /webapps 文件夹中,因此我可以进行更改,因为项目中没有使用 CI/CD。

**.properties 项目中的文件

  1. 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>

任何建议请我的路径出错了吗?

标签: javaspringspring-bootresttomcat

解决方案


推荐阅读