Spring Boot 自动配置特性

来自姬鸿昌的知识库
Jihongchang讨论 | 贡献2023年2月1日 (三) 09:39的版本
跳到导航 跳到搜索

https://www.bilibili.com/video/BV19K4y1L7MT/?p=7

怎么自动配好 Tomcat的?

怎么引入 tomcat 依赖的?

boot-01-helloworld - pom.xml

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

    </dependencies>


spring-boot-starter-web-x.x.x.RELEASE.pom

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-tomcat</artifactId>
      <version>2.3.4.RELEASE</version>
      <scope>compile</scope>
    </dependency>


自动配置好 Spring MVC

spring-boot-starter-web-x.x.x.RELEASE.pom

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>5.2.9.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>5.2.9.RELEASE</version>
      <scope>compile</scope>
    </dependency>