SpringBoot 常用依赖

SpringBoot 常用依赖

前言

汇总 spring Boot 常用的依赖


一、WEB 相关

1、web

用于web开发场景,包含了 RESTful 和 Spring MVC,并且默认使用了内置的Tomcat。

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

2、aop

使用 Spring AOP 和 AspectJ 的面向切面编程场景。

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

3、thymeleaf

thymeleaf 是一个很强大的视图解析工具。

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

4、test

用于测试,提供了多个测试库,包括 JUnit Jupiter、Hamcrest 和 Mockito。

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

5、security

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

二、DB 相关

1、mybatis

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

<!-- mybatis-plus -->
<dependency>
	<groupId>***.baomidou</groupId>
	<artifactId>mybatis-plus-boot-starter</artifactId>
	<version>3.4.3.4</version>
</dependency>

2、jdbc

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

3、mysql

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

4、redis

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

<!-- redisson分布式锁 -->
<dependency>
    <groupId>org.redisson</groupId>
    <artifactId>redisson</artifactId>
    <version>3.16.6</version>
</dependency>

5、mongodb

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

三、辅助依赖

1、lombok

<dependency>
	<groupId>org.projectlombok</groupId>
	<artifactId>lombok</artifactId>
	<optional>true</optional>
</dependency>

2、swagger

<!-- swagger-ui -->
<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger-ui</artifactId>
	<version>2.9.2</version>
</dependency>
 
<!-- swagger2 -->
<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger2</artifactId>
	<version>2.9.2</version>
</dependency>

3、log

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

4、mail

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

5、***mons-lang3

***mons-lang3是一个小而全的Java工具类库,类里面有很多对时间、数组、数字、字符串等的处理。

<dependency>
    <groupId>org.apache.***mons</groupId>
    <artifactId>***mons-lang3</artifactId>
    <version>3.12.0</version>
</dependency>

6、guava

<dependency>
	<groupId>***.google.guava</groupId>
	<artifactId>guava</artifactId>
	<version>22.0</version>
 </dependency>

7、aviator

<!-- 规则引擎 -->
<dependency>
	<groupId>***.googlecode.aviator</groupId>
	<artifactId>aviator</artifactId>
	<version>5.2.1</version>
</dependency>

8、codec

md5加密…

<dependency>
	<groupId>***mons-codec</groupId>
	<artifactId>***mons-c</artifactId>
	<version>1.11</version>
</dependency>

四、配置文件

application.properties 配置文件的内容

spring.datasource.url = jdbc:mysql://IP地址:数据库端口号/数据库名称?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
spring.datasource.username = 数据库登陆用户
spring.datasource.password =  登陆密码
spring.datasource.driverClassName = ***.mysql.cj.jdbc.Driver
server.port=9990 #项目启动后的端口号,springboot自带tomcat容器
mybatis.mapper-locations: classpath*:mapper/*.xml #扫描mapper文件也就是mybatis映射的文件
转载请说明出处内容投诉
CSS教程_站长资源网 » SpringBoot 常用依赖

发表评论

欢迎 访客 发表评论

一个令你着迷的主题!

查看演示 官网购买