功能:模拟从redis 中获取token ,(不真正的链接redis 只是生成一个简单的tokn)
首先建立一个项目 如下图所示
下边是我的所有maven 依赖
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-autoconfigure</artifactId> </dependency> <!-- 当别人在引入你的jar包时候 可以在配置文件中给他们提示 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> </dependency> </dependencies>
1 TokenAutoConfiguration 类
package com.jxd.to