EnvFile icon indicating copy to clipboard operation
EnvFile copied to clipboard

EnvFile not applied when reading `application.properties`

Open CodingAleCR opened this issue 3 years ago • 2 comments

I have a Spring Boot application running with configurations set in application.properties pointing to env vars in a .env file. However, when running the project, it does not recognize the environment variables. This used to work a while back (a couple of years ago) but now it does not.

Here's an example of how it's setup:

.env

SOME_ENV_VAR=mysecretvalue

application.properties

some.config.envvar=${SOME_ENV_VAR}

If I substitute all values in the application.properties for the ones in .env then the project runs just fine.

IDE: IntelliJ CE Configuration Type: Gradle task or Application EnvFile settings: Screen Shot 2022-11-30 at 18 18 20

CodingAleCR avatar Dec 01 '22 00:12 CodingAleCR

happens also to me , intellij 2021.3

nevotz avatar Jan 17 '23 18:01 nevotz

@nevotz in my case it was solved by upgrading Gradle on my project.

I understand this is not the best solution or something that everyone can do on their projects but I hope it helps. 🙏🏼

CodingAleCR avatar Jan 20 '23 23:01 CodingAleCR