Spring实现Redis简单实例
Redis安装
下载地址:https://github.com/tporadowski/redis/releases
启动命令:
// 进入Redis解压目录,cmd执行
redis-server.exe redis.windows.conf
详细参考:https://www.runoob.com/redis/redis-install.html
添加依赖
1 | // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-redis |
配置application.yml
1 | spring: |
RedisClient工具类
1 | import org.springframework.beans.factory.annotation.Autowired; |
Redis测试类
1 | import org.springframework.beans.factory.annotation.Autowired; |