配置文件放置的常见的四个位置
这四个位置的优先级
springboot 启动会扫描以下位置的application.properties或者application.yml文件作为Spring boot的默认配置文件:
优先级1:项目路径下的config文件夹配置文件,即在项目下直接建立config,在config下写application.properties或者application.yml。
优先级2:项目路径下配置文件,直接在项目下写application.properties或者application.yml。
优先级3:资源路径下的config文件夹配置文件,在resources下建立config,在下面写。
优先级4:资源路径下配置文件,在resources下直接写。
优先级由高到底,高优先级的配置会覆盖低优先级的配置