I'm trying to pass custom heroku config variable into application.properties but no value is passed.
My application.properties entry:
spring.mail.username=${SPRING_MAIL_SENDER_USERNAME}
Then I inject this value into String variable:
@Value("${spring.mail.username}")
private String SENDER_MAIL_USERNAME;
but the SENDER_MAIL_USERNAME is an empty string when I try to use it.
I can get the proper value like this:
System.getenv("SPRING_MAIL_SENDER_USERNAME");
but this is not what I'm looking for. Anyone knows what I'm doing wrong here?
EDIT:
Maybe it's worth to add that my project uses maven with 2 modules (backend and frontend). Simplified project structure looks like this:
-app
-backend
-src.main
-java.com.jakubeeee.app
-some java files...
-resources
-application.properties
-frontend
-src
-some web files...
I also use Procfile that contains:
web: java -Dserver.port=$PORT -jar $PATH_TO_JAR
where $PATH_TO_JAR is heroku config variable with value:
backend/target/myjarname.jar