spring-bootmavenspring-boot-maven-pluginspring-profiles

Hot to apply particular properties file to an application run by spring-boot-maven-plugin?


There is a properties file application-special.yml that I use for launching app locally with spring-boot-maven-plugin. When the file is located in main/resources it is enough to pass special as profile name to the command:

clean spring-boot:run -D spring-boot.run.profiles=special

How to apply this property file when it is located outside the project?


Solution

  • You can provide any number of external property files with spring-boot like this:

    mvn spring-boot:run -Dspring-boot.run.arguments="--spring.config.additional-location=file:/directory_path/filename.yml,file:/directory_path/filename2.yml"