🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
场景启动器会自动加载一些依赖,当我们启动 SpringBoot 项目时,场景启动器被调用,让相应的依赖组件工作。你可以到`pom.xml`中看当前的项目使用了哪些场景启动器。 ```xml <parent> <groupId>org.springframework.boot</groupId> <!-- SpringBoot父级场景启动器--> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.11.RELEASE</version> <relativePath /> </parent> <dependencies> <!-- web场景启动器 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- 测试场景启动器 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> ``` 我们查看` spring-boot-starter-parent`启动器有加载了哪些依赖,部分代码如下: ```xml <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.2.11.RELEASE</version> </parent> ``` 发现它又依赖了`spring-boot-dependencies`,我们再看`spring-boot-dependencies`又加载了哪些依赖,部分源码如下: ```xml <!-- 在properties中发现它指定了一些依赖的版本号 --> <properties> <log4j2.version>2.13.3</log4j2.version> <logback.version>1.2.3</logback.version> <lombok.version>1.18.16</lombok.version> </properties> ``` <br/> **** 查阅官方提供了哪些场景启动器:https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-starter