枕上诗书闲处好,门前风景雨来佳。这篇文章主要讲述redis存储token相关的知识,希望能为你提供帮助。
redis存储token
欢迎关注博主公众号「java大师」, 专注于分享Java领域干货文章http://www.javaman.cn/sb2/redis-token实现代码2.1 创建pom.xml
【redis存储token】 ?在实际开发中,token需要保存在redis中,今天我们就来介绍下token怎么存储在redis中?
< ?xml version="1.0" encoding="UTF-8"?>
< project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
< modelVersion> 4.0.0< /modelVersion>
< parent>
< groupId> org.springframework.boot< /groupId>
< artifactId> spring-boot-starter-parent< /artifactId>
< version> 2.2.6.RELEASE< /version>
< relativePath/> < !-- lookup parent from repository -->
< /parent>
< groupId> com.dashi< /groupId>
< artifactId> springsecurity-oauth< /artifactId>
< version> 0.0.1-SNAPSHOT< /version>
< name> springsecurity-oauth< /name>
< description> Demo project for Spring Boot< /description>
< properties>
< java.version> 1.8< /java.version>
< spring-cloud.version> Greenwich.SR2< /spring-cloud.version>
< /properties>
< dependencies>
< dependency>
< groupId> org.springframework.cloud< /groupId>
< artifactId> spring-cloud-starter-oauth2< /artifactId>
< version> 2.2.5.RELEASE< /version>
< /dependency>
< !--security依赖-->
< dependency>
< groupId> org.springframework.cloud< /groupId>
< artifactId> spring-cloud-starter-security< /artifactId>
< version> 2.2.5.RELEASE< /version>
< /dependency>
< !--boot依赖-->
< dependency>
< groupId> org.springframework.boot< /groupId>
< artifactId> spring-boot-starter< /artifactId>
< /dependency>
< !--boot依赖-->
< dependency>
< groupId> org.springframework.boot< /groupId>
< artifactId> spring-boot-starter-web< /artifactId>
< /dependency>
< !--test依赖-->
< dependency>
< groupId> org.springframework.boot< /groupId>
< artifactId> spring-boot-starter-test< /artifactId>
< scope> test< /scope>
< /dependency>
< !--redis依赖 -->
< dependency>
< groupId> org.springframework.boot< /groupId>
< artifactId> spring-boot-starter-data-redis< /artifactId>
< /dependency>
< !--commons-pool2对象依赖 -->
< dependency>
< groupId> org.apache.commons< /groupId>
< artifactId> commons-pool2< /artifactId>
< /dependency>
< /dependencies>
< build>
< plugins>
< plugin>
< groupId> org.springframework.boot< /groupId>
< artifactId> spring-boot-maven-plugin< /artifactId>
< /plugin>
< /plugins>
< /build>
< dependencyManagement>
< dependencies>
< dependency>
< groupId> org.springframework.cloud< /groupId>
< artifactId> spring-cloud-dependencies< /artifactId>
< version> $spring-cloud.version< /version>
< type> pom< /type>
< scope> import< /scope>
< /dependency>
< /dependencies>
< /dependencyManagement>
< /project>
2.2 创建springsecurity配置文件
package com.dashi.springsecurityoauth.config;
推荐阅读
- Spring源码解析之八finishBeanFactoryInitialization方法即初始化单例bean
- Linux i2c子系统驱动probe
- lsnrctl启动报错,Linux Error: 29: Illegal seek
- bluestacks蓝手指安卓模拟器删除图文详细教程
- 蓝手指安卓模拟器BlueStacks安装图文详细教程
- BlueStacks安卓模拟器安装步骤精简版
- BlueStacks蓝手指安卓模拟器ROOT权限图文详细教程
- 蓝手指安卓模拟器安装前注意事项
- 蓝手指模拟器游戏黑屏或无法运行的处理办法