springboot 启动会扫描以下位置的application.properties或者application.yml文件作为Spring boot的默认配置文件。
SpringBoot加载配置文件的优先级由高到低如下:

file: ./config/
file: ./
classpath: /config/
classpath: /

SpringBoot会从这四个位置全部加载主配置文件,高优先级的配置会覆盖低优先级的配置并且互补配置

说明: file就代表主目录下,classpath代表类路径下,若不懂见下图说明。
springboot加载配置文件的优先级高低

相关文章:

  • 2021-08-07
  • 2022-12-23
  • 2022-03-09
  • 2021-12-21
  • 2021-10-03
  • 2021-09-27
  • 2021-05-19
猜你喜欢
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
  • 2021-06-26
  • 2021-07-30
相关资源
相似解决方案