gpt4 book ai didi

java - Spring Boot application.yml 和 application.properties

转载 作者:行者123 更新时间:2023-11-30 02:30:20 25 4
gpt4 key购买 nike

我试图了解 application.yml 中是否有一些属性以及 application.properties 中是否有一些属性,我的应用程序会从这两个文件中读取吗?

最佳答案

根据Spring documentation - Change the Location of External Properties of an Application :

无论您在环境中设置什么,Spring Boot 始终会如上所述加载 application.properties。默认情况下,如果使用 YAML,则扩展名为“.yml”的文件也会添加到列表中。

Spring documentation - Externalized Configuration 章节中解释了考虑属性的顺序。 .

如果对已加载的文件有疑问,我建议将日志级别设置为DEBUG,这会在日志中显示加载的配置文件。

关于java - Spring Boot application.yml 和 application.properties,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44438417/

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