spring Cache 配置和调用过程
来源:互联网 发布:软件开发文档控制程序 编辑:程序博客网 时间:2024/06/06 01:50
在spring的配置中添加如下配置:主要有:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache-4.1.xsd
">
<!-- 激活自动代理功能 -->
<aop:aspectj-autoproxy proxy-target-class="true" />
<!-- 加载配置文件 -->
<context:property-placeholder location="classpath:redis.properties"
ignore-unresolvable="true" />
<context:property-placeholder location="classpath*:config.properties"
ignore-unresolvable="true" />
<bean id="LogAspect" class="com.supermap.realestate.organization.aspect.LogAspect"></bean>
<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
<property name="caches">
<set>
<bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean">
<property name="name" value="default"/>
</bean>
<bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean">
<property name="name" value="accountCache"/>
</bean>
</set>
</property>
</bean>
<!-- 扫描service自动注入为bean -->
<context:component-scan base-package="com.supermap.**.service.**" />
<context:component-scan base-package="com.supermap.**.core.**" />
<context:component-scan base-package="com.supermap.**.realm.**" />
<context:component-scan base-package="com.supermap.**.dao.**" />
<context:component-scan base-package="com.supermap.**.multidao.**" />
<context:component-scan base-package="com.supermap.realestate.mongo.**" />
<context:component-scan base-package="com.supermap.**.annoation.**" />
<context:component-scan base-package="com.supermap.**.aspect.**" />
<context:component-scan base-package="com.supermap.file" />
<bean id="springContext"
class="com.supermap.realestate.organization.core.SuperSpringContext"></bean>
<bean id="ProdefVersonMessage"
class="com.supermap.realestate.workflow.core.ProdefVersonMessage"></bean>
<bean class="com.supermap.realestate.tenant.listener.ConfigLisener" />
<cache:annotation-driven />
</beans>
第二部:在对应的service的方法中添加@Cacheable即可
阅读全文
0 0
- spring Cache 配置和调用过程
- 使用spring cacheManager配置Guava Cache和Redis Cache
- 使用spring cacheManager配置Guava Cache和Redis Cache
- spring实例和调用过程
- Spring boot配置cache
- spring boot 配置Cache
- 使用spring和hibernate配置ehcache和query cache
- 使用spring和hibernate配置ehcache和query cache
- spring-boot中配置和使用Caffeine Cache
- spring-boot中配置和使用Caffeine Cache
- spring cache和ehcache
- spring结合hibernate cache配置
- Spring Cache + Redis配置备忘
- Spring 3.1 配置cache详解
- Spring boot配置cache(ehcache)
- 【Spring】Spring常用配置-Spring EL和资源调用
- spring 定时任务调用存储过程配置示例(未测试)
- Spring线程池ThreadPoolTaskExecutor配置过程以及调用
- Smack jar包介绍
- libevent例子:time-test.c
- 新员工入职详细培训计划
- H
- cout.setf(ios_base::fixed,ios_base::floatfield);
- spring Cache 配置和调用过程
- ajax提交表单后,页面仍被刷新
- 《简约至上 交互式设计四策略》
- 如何将本地项目添加到github上
- 有序表的查找
- [HDU](2049)考新郎 --组合数+错排
- 路由和路由算法
- python自动配置java环境(linux)
- percona-toolkit的简介和安装