how to pass application.properties in commandLine

2020-05-27 02:39发布

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.

1条回答
男人必须洒脱
2楼-- · 2020-05-27 03:22

You can do that with spring.config.location property:

mvn spring-boot:run -Dspring.config.location=your.properties
查看更多
登录 后发表回答