一、添加Redis Maven依赖
<!-- redis -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.7.1.RELEASE</version>
</dependency>
redis.host=192.168.0.254
redis.port=6379
redis.password=jedis21tb
redis.maxIdle=300
redis.maxWait=1000
redis.testOnBorrow=true
redis.timeout=3000
三、spring配置文件(applicationContext.xml):