SpringBoot整合redis
SpringBoot操作redis
参考文档 https://docs.spring.io/spring-boot/docs/2.0.4.RELEASE/reference/htmlsingle/#boot-features-redis
1.新建SpringBoot项目 配置pom.xml文件
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
2.在控制器中注入redisTemplate,操作redis数据库
@Autowired
private StringRedisTemplate redisTemplate;
通过图形化界面查看数据: