I have an application in spring-boot 2.2.4
When I launch the application like this :
java -jar ../batch-pj-clean-nas/target/batch-pj-clean-nas-1.0.0-SNAPSHOT.jar -Dconfig.location=application.properties
Everything is ok.
When I try like that :
su - sbert -c "java -jar /home/sbert/workspace/pj/batch-pj-clean-nas/target/batch-pj-clean-nas-1.0.0-SNAPSHOT.jar -Dconfig.location=application.properties"
the properties is not loaded
Could not resolve placeholder 'nas.base.directory' in value "${nas.base.directory}"
I try with OS ubuntu, RH8 and spring-boot 2.2.4 or 2.1.3 and replace -Dconfig.location by --spring.config.location
如果要从 Jar 外部加载它,请提供 application.properties 文件的完整路径
I finally found the reason : I have to use :
su sbert -c
instead of
su - sbert -c
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.