springboot的优势便是封装了多个模块。在应用开发过程中,我们只需要根据需求引入相应的场景启动器即可。spring boot会自动进行配置。
下面是一些常用的场景启动器:
1. spring-boot-starter-parent(控制版本信息)
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/>
</parent>
Spring Boot的版本仲裁中心,控制了所有依赖的版本号,
好处:以后我们导入依赖默认是不需要写版本;
2. spring-boot-starter-web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
web的场景,自动帮我们引入了web模块开发需要的相关jar包
3. spring-boot-starter-test
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
springboot程序测试依赖,如果是自动创建项目默认添加
4.mybatis-spring-boot-starter
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
MyBatis-Spring-Boot-Starter类似一个中间件,链接Spring Boot和MyBatis,构建基于Spring Boot的MyBatis应用程序。
5. mysql-connector-java:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
mysql-connector-java 是MySQL的JDBC驱动包,用JDBC连接MySQL数据库时必须使用该jar包。