简体   繁体   中英

How to specify external properties files in application.properties in Spring Boot?

I have a project Projects/MyApp .

I have external properties files Projects/files .

I try to use in application.properties :

spring.config.location=classpath:../files

files directory contains application-database.properties

I've tried also spring.config.location=file:../files/application-database.properties

but It doesn't work. What is wrong?

as I understand you what to use properties for your database in the application-database.properties file and you don't want to get credentials at your war file after the build. You can put your database credentials to Idea Environment Variables and remove from the .properties file. What do you think about it? 在此处输入图片说明

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM