gpt4 book ai didi

Spring 3.1 配置文件 : how to set in Stackato Tomcat container

转载 作者:行者123 更新时间:2023-11-28 23:02:17 24 4
gpt4 key购买 nike

我正在使用 Spring 3.1.3 和新的配置文件功能。当我在我的 IDE 中为 spring_profiles_active=NONPROD 设置环境时,它工作正常。但是,当我部署到我们也使用 Tomcat 的 aPaaS 环境时,它没有被拾取。

我不应该只能够执行以下操作吗:

env:
CATALINA_OPTS: -Dspring_profiles_active=NONPROD

如果我通过 ssh 连接到机器,我会看到它正在设置。知道为什么 Spring 没有接受这个吗?

最佳答案

将以下行添加到您的 manifest.yml 文件中以在 Stackato 中激活 Spring 配置文件:

env:
spring_profiles_active:
default: NONPROD

这会将 spring_profiles_active 放入环境变量中,Spring 会愉快地从那里读取它。请注意,您必须在变量名称中使用下划线,因为 Stackato 不喜欢其中的点。原因是 Linux 环境变量名称不应该包含点,以便 shell 程序可以正确使用它们。

关于Spring 3.1 配置文件 : how to set in Stackato Tomcat container,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16824633/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com