token+Redis实现登录与退出登录
application.properties配置文件添加Sql、Redis配置信息
#MySQL配置
spring.datasource.url=jdbc:mysql://localhost:3306/【数据库】?useUnicode=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=round&autoReconnect=true&serverTimezone=GMT
spring.datasource.username=【数据库账号】
spring.datasource.password=【数据库密码】
#Redis配置
spring.redis.host=【服务器地址】
spring.redis.password=【Redis密码】
spring.redis.port=6379【Redis默认端口】
Controller接受请求判断登录账号密码 生成Token并存入Redis
@RequestMapping(method = RequestMethod.POST)
@ApiOperation(value = “登录”)
public ResponseEntity login(@RequestParam String username, @RequestParam String password) {
//此处判断传进来的值是否为空 可用if判断
Assert.notNull(username, “userna