use*_*971 6 java spring yaml docker docker-compose
我需要设置名称如 的环境变量com.somesite.apikey。我在我的docker-compose.yml中尝试这些变体
environment:
com.somesite.apikey: 98989897979
com_somesite_apikey: 98798709089
Run Code Online (Sandbox Code Playgroud)
但方法System.getProperty("com.somesite.apikey")返回空。谁能帮我解决这个问题吗?
关于设置属性的 Spring Boot 文档指出,环境变量的“拼写”必须是
环境变量:大写格式,下划线作为分隔符。
所以你应该能够设置
environment:
COM_SOMESITE_APIKEY: 98798709089
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4639 次 |
| 最近记录: |