问题
I am running a spring boot dockerized application with embedded tomcat. I have a properties file called myconfig.properties
under resources folder
myconfig.properties
myvariable=${ENV_MYVARIABLE}
This file content is required during startup of app.The file is consumed by a library which is accessed during startup. Spring boot is replacing the envioronment variables under application.properties file but this env variable in myconfig.properties
file is not replaced. The file is no where accessed within my code. the third party library requires the file during startup and during it's execution, it reads the contents of the file.Since this env variable is not replaced, my app is not starting up. The variable is supplied as env variable to docker during docker run
, just like other variables.Can somebody please help
FYI, if i run the springboot jar in my local machine , by setting the env vairables in terminal, the app can access the variables, if am writing as myvariable=${env.ENV_MYVARIABLE}
. But in Docker, the app cant access
来源:https://stackoverflow.com/questions/65016697/spring-boot-env-vaiables-are-not-replaced-in-custom-property-file