Spring boot env vaiables are not replaced in custom property file

老子叫甜甜 提交于 2021-01-07 06:37:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!