java jjwt-api使用,java jwt使用,java jwt 工具类,Java Web Token工具类
Springboot jwt整合
================================
©Copyright 蕃薯耀 2020-12-02
https://www.cnblogs.com/fanshuyao/
一、引入jjwt-api依赖
<properties>
<!-- 构建时编码 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- 输出时编码 -->
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- JDK版本 -->
<java.version>1.8</java.version>
<jjwt.version>0.11.2</jjwt.version>
</properties>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>${jjwt.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>${jjwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>${jjwt.version}</version>
<scope>runtime</scope>
</dependency>
二、 jjwt-api实现工具类
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import