[英]How to use environment variables in spring-boot
I want to load properties from external file present under my home directory.我想从我的主目录下的外部文件加载属性。 I set a environment variable using the file as follows
我使用该文件设置了一个环境变量,如下所示
export ENV_HOME=/home/usr/environment.properties
I want to use the properties present in environemnt.properties files in spring-boot application.我想在 spring-boot 应用程序中使用 environemnt.properties 文件中存在的属性。 I don't want to include this in packed jar
我不想把这个放在包装好的罐子里
How to achieve this?如何实现这一目标?
在控制器中使用 @PropertySource("${ENV_HOME}") 将覆盖来自外部文件的属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.