springboot-learn-02

  1. 创建springboot项目的三种方式
    这里,使用idea:
    springboot-learn-02
    springboot-learn-02
    springboot-learn-02
    springboot-learn-02
    项目结构:
    springboot-learn-02
  2. 解析springboot中的parent

springboot-learn-02
springboot-learn-02
springboot-learn-02
3. 理解Spring Boot 的配置文件 application.properties

首先,当我们创建一个 Spring Boot 工程时,默认 resources 目录下就有一个 application.properties 文件,可以在 application.properties 文件中进行项目配置,但是这个文件并非唯一的配置文件,在 Spring Boot 中,一共有 4 个地方可以存放 application.properties 文件。

  1. 当前项目根目录下的 config 目录下
  2. 当前项目的根目录下
  3. resources 目录下的 config 目录下
  4. resources 目录下
    优先级:这四个位置是默认位置,即 Spring Boot 启动,默认会从这四个位置按顺序去查找相关属性并加载。
    springboot-learn-02