Achaius
Achaius

Reputation: 6124

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. I don't want to include this in packed jar

How to achieve this?

Upvotes: 1

Views: 1102

Answers (1)

Achaius
Achaius

Reputation: 6124

Use @PropertySource("${ENV_HOME}") in controller will override the properties from external file.

Upvotes: 1

Related Questions