简体   繁体   English

将多个 spring-boot 属性文件合并到一个文件中

[英]Merge multiple spring-boot property file in a single file

Is there any automation tool that allows merging multiple properties files in a single file, using spring boot profiles:是否有任何自动化工具允许使用 spring 引导配置文件将多个属性文件合并到一个文件中:

from:从:

  • application-dev.properties应用程序-dev.properties
  • application-uat.properties应用程序-uat.properties
  • application-prd.properties应用程序-prd.properties

to:至:

  • application.properties应用程序属性

I know I could do this with a copy/paste but there are hundreds of files for different environments so I want to avoid mistakes.我知道我可以通过复制/粘贴来做到这一点,但是对于不同的环境有数百个文件,所以我想避免错误。

Thanks谢谢

You will have to write a shell script to do this while app deployment or right some task in grade/maven to merge all the files.您必须编写 shell 脚本来执行此操作,同时部署应用程序或在等级/maven 中正确执行某些任务以合并所有文件。

Or you can use @PropertySource to add all of these properties.或者您可以使用@PropertySource 添加所有这些属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用spring-boot存储库返回单个属性 - Return single property with spring-boot repository 在 Spring-Boot 4 中,尝试注入属性文件值 - In Spring-Boot 4, trying to inject property file values Spring-Boot 多模块项目加载属性文件 - Spring-Boot multi module project load property-file 如何在Spring-Boot中获取属性文件的bean? - How can I get the bean of a property file in Spring-Boot? 如何在spring-boot中从属性文件读取值并在断言测试中使用它 - how to read values from the property file in spring-boot and use it in asserting the tests spring-boot:使用硬编码的文件名配置属性文件的不同版本? - spring-boot: configuring different versions of a property-file with hardcoded filename? 如何在 spring-boot 中使用具有多个数据库的 Mongodb 单实例 - how to use Mongodb Single instance with multiple dbs in spring-boot spring-boot testing - 多个测试可以共享一个上下文吗? - spring-boot testing - Could multiple test share a single context? 使用来自 yaml 文件的多个 cron 表达式 Spring-Boot 一个 @Scheduled 任务 - Spring-Boot one @Scheduled task using multiple cron expressions from yaml file 如何在Spring Boot应用程序中从YML文件加载多个属性 - How to load multiple properties from YML file in spring-boot application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM