Almir Fontenele
Almir Fontenele

Reputation: 35

how to set application property variable with system eviroment

I need to set applcation properties variable with system variable Ex.

my system variable enviroment on widows is USER_NAME = admin

I want that set spring.datasource.username with USER_NAME

I tryed to do this mode:

in application.properties file spring.datasource.username={USER_NAME}

but dind't set.

anybody knows how to do?

Upvotes: 0

Views: 147

Answers (1)

Adina Rolea
Adina Rolea

Reputation: 2109

In your application properties the values should be with lower case and separated by point:

spring.datasource.username=${user.name}

Your environment variable should be as you've mentioned:

USER_NAME=admin

Upvotes: 1

Related Questions