I have a spring boot application and I want to pass application.properties file in commandLine when I start-up.
i.e when I run mvn spring-boot:run --application.properties
I will have a default application.properties in src/main/resources. but that is only for testing purposes. In the production run, I would like to pass the property file in commandLine.
I am aware of passing single arguments such as
mvn spring-boot:run --server.port=9001.
But I have many such properties and would prefer to pass a property file if that is possible.
You can do that with spring.config.location property:
mvn spring-boot:run -Dspring.config.location=your.properties
来源:https://stackoverflow.com/questions/31819300/how-to-pass-application-properties-in-commandline-for-a-spring-boot-application