简体   繁体   中英

How can I get Spring Boot to load the Java System.getenv() variables into the Environment object?

Azure loads startup details into the System.getenv() properties. I would like them to show up in the Environment variable from Spring.

How can I accomplish this?

As a side note, is there a way to add a system variable at startup (for testing?)

you can add all your properties to application.properties in Spring Boot. otherwise, you can add a Bean in your spring boot application class that reads from the system properties & loads them.

The actual answer to this question is "nothing". Spring boot automatically loads all the System.getenv() into the Environment variable at startup.

See: Spring Boot docs

And yes, I am a bit embarrassed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM