Maven依赖

本文最后更新于:2 分钟前

一些常用的Maven依赖

一些常用

MySQL

1
2
3
4
5
6
<!--MySQL-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>

JDBC

1
2
3
4
5
<!-- jdbc-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>

log4j

1
2
3
4
5
6
<!--log4j-->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>

druid

1
2
3
4
5
6
<!--druid-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.14</version>
</dependency>

Thymeleaf

1
2
3
4
5
6
7
8
9
<!--thymeleaf模板引擎-->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring5</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>

Thymeleaf和security整合包

1
2
3
4
5
6
<!-- thymeleaf整合包 -->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>

Spring整合thymeleaf模板

1
2
3
4
5
6
7
8
9
<!--thymeleaf模板-->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring5</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>

Shiro

1
2
3
4
5
6
<!-- shiro -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.5.3</version>
</dependency>

SpringSecurity

1
2
3
4
5
6
<!--security-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>2.3.1.RELEASE</version>
</dependency>

热部署

1
2
3
4
5
6
<!-- 热部署 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 这个需要为 true 热部署才有效 -->
</dependency>

JSONObject

1
2
3
4
5
6
7
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<!-- 必须加jdk的版本号 -->
<classifier>jdk15</classifier>
</dependency>

fastjson

1
2
3
4
5
6
<!--fastjson-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.76</version>
</dependency>

commons-lang3

1
2
3
4
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>

jwt

1
2
3
4
5
6
<!--  jwt-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>

用来 md5加密的

1
2
3
4
5
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>

七牛云

1
2
3
4
5
6
<!--       七牛-->
<dependency>
<groupId>com.qiniu</groupId>
<artifactId>qiniu-java-sdk</artifactId>
<version>[7.7.0, 7.7.99]</version>
</dependency>

commons-io

1
2
3
4
5
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>

SpringBoot 整合相关

整合mybatis

1
2
3
4
5
6
<!--引入mybatis-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>

整合mybatisplus

1
2
3
4
5
6
<!--mybatisplus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.3</version>
</dependency>

mybatisplus 代码生成

1
2
3
4
5
6
<!--代码生成依赖-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.4.1</version>
</dependency>

整合redis

1
2
3
4
5
<!-- redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

整合thymeleaf

1
2
3
4
5
<!--  thymeleaf-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

整合AOP

1
2
3
4
5
<!--  aop-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>

整合knife4j文档

1
2
3
4
5
6
<!--knife4j-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.7</version>
</dependency>

常用命名空间

th:

1
xmlns:th="http://www.thymeleaf.org"

sec:

1
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4"

application.yml 常用配置

端口号和请求前缀

1
2
3
4
server:
port: 8089
servlet:
context-path: /blog #接口请求前缀

连接数据库

1
2
3
4
5
6
# mysql
datasource:
url: jdbc:mysql://127.0.0.1:3306/blog?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver #数据库驱动

mybatis

1
2
3
4
5
6
7
8
9
#mybatis
mybatis:
mapper-locations: classpath:/mapper/*.xml #mapper.xml 所在目录
configuration:
log-prefix: repository.
#驼峰命名
map-underscore-to-camel-case: true
# 日志
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl

pagehelper分页插件

1
2
3
4
5
6
#pagehelper分页插件
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSq

redis

1
2
3
4
redis:
port: 6379
database: 0
host: localhost

thymeleaf

1
2
3
4
5
6
thymeleaf:
mode: HTML5
encoding: UTF-8 #编码
content-type: text/html #类型
cache: false #缓存
prefix: classpath:/templates/ #目录

上传文件大小

1
2
3
4
5
6
7
8
9
spring:
application:
name: jinan_blog #别名
servlet:
multipart:
# 单个文件的最大值
max-file-size: 2MB
# 上传文件总的最大值
max-request-size: 20MB

本文作者: 仅安
本文链接: https://jinan6.vip/posts/3261239934/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!