Maven的方法很简单:
mvn clean install -Dspring.config.location=/path/config.properties
如何使用Gradle做到这一点?
最佳答案
您应该指定一个任务并在build.gradle文件中添加jvmArgs以运行spring boot应用程序:
bootRun {
jvmArgs = ["-Dspring.config.location=/prop.properties"]
}
或在命令行中运行:
gradle clean build bootRun -Drun.jvmArgs="-Dloader.config.location=/path/to/prop/file"
关于spring-boot - 如何:使用外部配置文件构建Gradle Spring Boot应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52097929/