当前位置: 首页 > news >正文

蚌埠市网站建设_网站建设公司_轮播图_seo优化

昌邑建设局网站,机关网站制度建设,上海外贸网站开发,如何做自己网站的seo我最近在博客中谈论有关Spring 3.1及其新的缓存注释Cacheable和CacheEvict 。 与所有Spring功能一样#xff0c;您需要进行一定数量的设置#xff0c;并且通常使用Spring的XML配置文件来完成。 在缓存的情况下#xff0c;打开Cacheable和CacheEvict并不容易#xff0c;因为… 我最近在博客中谈论有关Spring 3.1及其新的缓存注释Cacheable和CacheEvict 。 与所有Spring功能一样您需要进行一定数量的设置并且通常使用Spring的XML配置文件来完成。 在缓存的情况下打开Cacheable和CacheEvict并不容易因为您要做的就是将以下内容添加到Spring配置文件中 cache:annotation-driven / …以及您的beans XML元素声明中的适当模式定义 beans xmlnshttp://www.springframework.org/schema/beans xmlns:phttp://www.springframework.org/schema/pxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:cachehttp://www.springframework.org/schema/cache xmlns:contexthttp://www.springframework.org/schema/contextxsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.1.xsdhttp://www.springframework.org/schema/cachehttp://www.springframework.org/schema/cache/spring-cache.xsd …的主要特点是 xmlns:cachehttp://www.springframework.org/schema/cache …和 http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd 但是这还不是故事的结局因为您还需要指定一个缓存管理器和一个缓存实现。 好消息是如果您熟悉其他Spring组件例如数据库事务管理器的设置那么这样做的方式就不足为奇了。 缓存管理器类似乎是实现Spring的org.springframework.cache.CacheManager接口的任何类。 它负责管理一个或多个缓存实施其中缓存实施实例负责实际缓存数据。 下面的XML示例摘自我最近两个博客中使用的示例代码。 bean idcacheManager classorg.springframework.cache.support.SimpleCacheManagerproperty namecachessetbeanclassorg.springframework.cache.concurrent.ConcurrentMapCacheFactoryBeanp:nameemployee/!-- TODO Add other cache instances in here--/set/property /bean 在上面的配置中我使用Spring的SimpleCacheManager来管理其ConcurrentMapCacheFactoryBean实例该实例的缓存实现名为“ employee ”。 需要注意的重要一点是您的缓存管理器必须具有cacheManager 。 如果您弄错了那么将得到以下异常 org.springframework.beans.factory.BeanCreationException: Error creating bean with name org.springframework.cache.interceptor.CacheInterceptor#0: Cannot resolve reference to bean cacheManager while setting bean property cacheManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named cacheManager is definedat org.springframework.beans.factory.support.BeanDefinitionValueResolver. resolveReference(BeanDefinitionValueResolver.java:328)at org.springframework.beans.factory.support.BeanDefinitionValueResolver. resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory. applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory. populateBean(AbstractAutowireCapableBeanFactory.java:1118)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory. doCreateBean(AbstractAutowireCapableBeanFactory.java:517) : : trace details removed for clarity :at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner. runTests(RemoteTestRunner.java:683)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner. run(RemoteTestRunner.java:390)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner. main(RemoteTestRunner.java:197) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named cacheManager is definedat org.springframework.beans.factory.support.DefaultListableBeanFactory. getBeanDefinition(DefaultListableBeanFactory.java:553)at org.springframework.beans.factory.support.AbstractBeanFactory. getMergedLocalBeanDefinition(AbstractBeanFactory.java:1095)at org.springframework.beans.factory.support.AbstractBeanFactory. doGetBean(AbstractBeanFactory.java:277)at org.springframework.beans.factory.support.AbstractBeanFactory. getBean(AbstractBeanFactory.java:193)at org.springframework.beans.factory.support.BeanDefinitionValueResolver. resolveReference(BeanDefinitionValueResolver.java:322) 就像我在上面说的那样在我的简单配置中整个工作由SimpleCacheManager协调。 根据文档这通常是“用于测试或简单的缓存声明”。 尽管您可以编写自己的CacheManager实现但Spring的专家们为不同情况提供了其他缓存管理器 SimpleCacheManager –参见上文。 NoOpCacheManager –用于测试因为它实际上并不缓存任何内容尽管在这里要小心因为在不进行缓存的情况下测试代码可能会在打开缓存时使您绊倒。 CompositeCacheManager –允许在单个应用程序中使用多个缓存管理器。 EhCacheCacheManager –包装ehCache实例的缓存管理器。 见http://ehcache.org 对于Spring Profile选择在任何给定环境中使用哪个缓存管理器似乎是一个很好的用途。 看到 在XML Config中使用Spring配置文件 使用Spring Profiles和Java配置 而且尽管只是为了完整起见但这只是将内容整理一下下面是我前两个博客中使用的完整配置文件 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beans xmlns:phttp://www.springframework.org/schema/pxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:cachehttp://www.springframework.org/schema/cache xmlns:contexthttp://www.springframework.org/schema/contextxsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsdhttp://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd!-- Switch on the Caching --cache:annotation-driven /!-- Do the component scan path --context:component-scan base-packagecaching /!-- simple cache manager --bean idcacheManager classorg.springframework.cache.support.SimpleCacheManagerproperty namecachessetbean classorg.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean p:nameemployee/!-- TODO Add other cache instances in here--/set/property/bean/beans 正如哥伦波中尉喜欢说“还有一件事你知道让我为这个案件烦恼……” 好吧关于缓存管理器有几件事让我感到困扰例如 在谈论SimpleCacheManager时Spring的家伙们所说的“对测试或简单的缓存声明有用”是什么意思 您究竟应该何时愤怒地使用它而不是进行测试 最好编写自己的CacheManager实现甚至是Cache实现吗 使用EhCacheCacheManager确切优势是什么 您真正需要多少时间CompositeCacheManager 我将来可能会研究所有这些…… 祝您编程愉快别忘了分享 参考来自Captain Debugs Blog博客的JCG合作伙伴 Roger Hughes的Spring 3.1 Caching and Config 。 翻译自: https://www.javacodegeeks.com/2012/09/spring-31-caching-and-config.html
http://www.ihoyoo.com/news/97551.html

相关文章:

  • 米拓模板网站建设鹤岗商城网站建设
  • 织梦网络设计工作室网站模板杭州十大科技公司排名
  • 保险网站有哪些保险网站大学城网站开发公司电话
  • 万网主机 网站重做3天引流800个人技巧
  • 莱芜网站优化团队公众号开发网站公司
  • 嘉兴网站定制工程项目
  • 单页面网站带后台装酷网
  • 运城网站建设网站邮箱格式怎么写
  • 丰都网站建设美工设计素材网站
  • 图片库网站建设wordpress 电台网站
  • 网站一般字体建个个人网站一年多少钱
  • 莱芜网站建设公司seo的搜索排名影响因素主要有
  • 建设专业网站的价格wordpress移动端m
  • 电子商务网站建设与实践上机指导移动网站建设商
  • h5网站架设seo公司推广宣传
  • 广饶网站定制网站建设收费标准案例
  • 销售员做网站东莞市网站建设公司哪家好
  • 住房城乡住房和城乡建设部网站首页网站开发服务转包合同
  • 南城区网站仿做企业信息查询系统官网贵州
  • 制作企业推广网站上海公司做网站
  • 有没有专门做纸箱的网站网站建设多少钱 小江网页设计
  • 网站建设与管理职责做网站用php还是node
  • 海南专业网站建设定制wordpress 没有小工具
  • 网站建设哪家较好总结 设网站
  • 可以做图接单的网站wordpress搭建镜像
  • 一诺建站产品营销推广策略
  • 维品网站建设建好的网站怎么用
  • 外贸导向企业网站免费中文WordPress主题
  • 电子商务网站建设项目规划书网站开发合同是否是技术合同
  • 优秀htm网站使用wordpress标签库