java - Spring Boot 2 没有获取操作系统环境变量
问题描述
我已经设置了一些操作系统变量,并希望 Spring 自动选择它们。
但这不会发生。例如,spring.datasource.username
应该从 OS 变量中提取,尽管我在运行应用程序时收到此错误java.sql.SQLSyntaxErrorException: Access denied for user ''@'localhost'
两者都没有spring.profiles.active
被拾起,因此我看到了这个No active profile set, falling back to default profiles: default
解决方案
这些环境变量看起来不太正确。我认为 Spring 会期望它们像
SPRING_PROFILES_ACTIVE
SPRING_APPLICATION_JSON
作为实际的环境变量。我已经能够设置其他值,但它们需要采用该格式作为环境变量。
更多细节可以在
推荐阅读
- php - 只有一个空格,如果你只有一个空格,请删除
- c++ - 如何用另一个模板函数(特别是 glm::dot)包装模板函数?
- flutter - 列的颤振溢出问题
- go - kubernetes client-go 将yaml转成go代码
- xamarin - Xamarin 表单 ios 应用程序由于已弃用的 API 使用 UIWebView 而被拒绝
- python - 如何在通过 SSO 凭证连接时使用 AWS Python 开发工具包
- c - CS50 Week1:信用任务改进?
- nginx - 卷曲以“卷曲:(6)无法解析主机:HTTP”结尾
- python - 如何在 EC2 实例中使用 boto3
- laravel - 观察者不运行 save() 和 retrieved() 方法