springboot已经通过利用spring-boot-test-autoconfigure,很好地集成了redis,因此在调用redisTemplate时候,直接注入即可,不需要另外写配置类,除非有特殊的业务要求
工具类可以将对象保存到redis中,至于字符串,列表等操作,以后继续写
配置pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
</dependency>
redis工具类