air*_*fox 5 grails spring-boot grails-3.0
grails.config.locationsgrails 3中没有属性,现在Grails 3使用Spring的属性源概念,但是如何在grails 3中实现与之前版本相同的行为?假设我想property.to.be.overridden用我的外部配置文件覆盖application.grovy文件中的某些属性.我该怎么做?
等价grails.config.locations于是spring.config.location
这是一个在从命令行启动 jar 时指定配置位置的示例(这些相同的参数可以在您的 ide 内部使用)
java -jar myproject.jar --spring.config.location=classpath:/default.properties,classpath:/override.properties
Run Code Online (Sandbox Code Playgroud)
另外,由于您提到想要覆盖属性,因此了解 Spring Boot 处理配置文件特定属性文件的方式很有用(也可以指定多个配置文件)
| 归档时间: |
|
| 查看次数: |
2107 次 |
| 最近记录: |