【问题标题】:How does Spring read application ymlSpring如何读取应用程序yml
【发布时间】:2017-01-25 18:18:35
【问题描述】:

我是 spring 新手,我正在努力了解基础知识。

从头开始,我知道应用程序 yml 是包含我所有属性的地方。

比如我的 spring.datasource 里面有我的数据库连接细节和驱动信息。

但是spring是怎么知道application.yml的

它怎么知道往下看

src/main/resources/config/application.yml

我已经用谷歌搜索了,但我没有找到任何关于此的信息。

【问题讨论】:

  • boot-features-external-config 文件在类路径中,spring 搜索它
  • 以这样的态度(试图了解真正发生的事情)你将永远无法使用 Spring :)
  • 谢谢!这是有道理的!

标签: spring spring-boot


【解决方案1】:

您的 application.yaml 的解析方式与boot-features-external-config-application-property-files 中描述的 application.properties 相同

【讨论】:

    猜你喜欢
    • 2016-01-30
    • 1970-01-01
    • 2018-07-07
    • 2020-09-12
    • 2017-01-05
    • 1970-01-01
    • 1970-01-01
    • 2020-02-14
    • 1970-01-01
    相关资源
    最近更新 更多