SpringBoot项目中基本常用依赖分享(个人向)

 

目录 

(1)spring-boot-starter-web

(2)mysql-connector-java

(3)mybatis-spring-boot-starter

(4)mapper-spring-boot-starter

(5)mybatis-plus-boot-starter

(6)spring-boot-starter-data-redis

(7)spring-boot-starter-tomcat

(8)spring-boot-starter-test

(9)后续补充。。

(1)spring-boot-starter-web

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

spring-boot-starter-web是一个依赖库,为web开发予以支持。同时提供了嵌入的Servlet容器以及SpringMVC提供了大量自动配置,可以适用于大多数web开发场景。只要我们在SpringBoot项目中的pom.xml中引入了spring-boot-starter-web依赖,即使不进行任何配置,也可以使用Spring MVC进行Web开发。

(2)mysql-connector-java

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

数据库驱动,用于连接数据库。注意在SpringBoot项目中不给定版本,则默认其中的版本是8.0以上的,因此一定要注意与数据库系统版本的适配。如5.7的MySQL是不适用8.0驱动的

(3)mybatis-spring-boot-starter

        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.3.2</version>
        </dependency>

整合MyBatis框架的必备依赖,当学到SpringBoot时,MyBaits的作用已经无需多言,其一直是作为一款优秀的持久层框架而存在。

(4)mapper-spring-boot-starter

        <!--通用mapper依赖-->
        <dependency>
            <groupId>tk.mybatis</groupId>
            <artifactId>mapper-spring-boot-starter</artifactId>
            <version>2.1.5</version>
        </dependency>

通用Mapper依赖,是我在项目中经常使用到的依赖。最常用在减少冗余的sql代码量,如最基本的CRUD。用法是在自定义的Mapper接口中继承Mapper即可使用其中所写好的实现类。

(5)mybatis-plus-boot-starter

  <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.0.5</version>
  </dependency>

与(4)作用类似,在mybatis的基础上,封装了基本的常用sql语句,简化了开发人员的冗余代码量,使我们能更专注于业务层面上的开发。(注意版本,有些版本有时会报错,最好还是选择稳定的版本。)

(6)spring-boot-starter-data-redis

  <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
            <version>2.4.5</version>
  </dependency>

redis,之前的博客已有我的通俗介绍,这里便不再重复。

(7)spring-boot-starter-tomcat

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

内嵌tomcat功能,使得SpringBoot项目无需部署服务器环境便可直接运行,大多时候属于必须用上的依赖。

(8)spring-boot-starter-test

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

用于测试。包含例如常用的@Test注解

(9)后续补充。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

蜗牛变涡流

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值