依赖jar包:
Xml代码 收藏代码
<!-- redis -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.5.2</version>
</dependency>
applicationContext-cache-redis.xml
Xml代码 收藏代码
<context:property-placeholder
location="classpath:/config/properties/redis.properties" />
<!-- 启用缓存注解功能,这个是必须的,否则注解不会生效,另外,该注解一定要声明在spring主配置文件中才会生效 -->
<cache:annotation-driven cache-manager="cacheManager" />
<!-- spring自己的换管理器,这里定义了两个缓存位置名称 ,既注解中的value -->
<bean ;
}
});
}
}
相关文章: