gpt4 book ai didi

java - 如何排除默认的 application.properties 使用 maven 中的配置文件为 Spring Boot 项目添加自定义属性文件?

转载 作者:行者123 更新时间:2023-12-01 21:22:04 24 4
gpt4 key购买 nike

我使用 Spring Boot 开发了一个 Web 应用程序。我在 src/main/resources staging、qa、product 中有三个资源文件夹,其中包含特定环境的应用程序属性和日志记录配置。除了这些文件夹之外,我还有 application.properties 和资源文件夹中的日志配置,我将其用于开发环境。我想使用 spring-boot-maven 插件根据环境打包war文件。我是 Maven 新手,有任何帮助吗?

最佳答案

约定为application-{profileName}.properties

第 10 点和第 11 点:

http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html

例如application-test.properties它覆盖application.propertiespom.xml

中创建配置文件

简介简介: http://maven.apache.org/guides/introduction/introduction-to-profiles.html

关于java - 如何排除默认的 application.properties 使用 maven 中的配置文件为 Spring Boot 项目添加自定义属性文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38970146/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com