java - 通过 memcache 集成的 spring mvc 中的这个错误是什么

标签 java spring-mvc caching memcached simple-spring-memcached

我想使用simple-spring-memcached来缓存数据。所以用这个 https://code.google.com/p/simple-spring-memcached/wiki/Getting_Started为了我的目的。 我在我的 dispatcher-servlet.xml 中添加

  <aop:aspectj-autoproxy />
  <import resource="simplesm-context.xml" /> 
  <bean name="cacheManager" class="com.google.code.ssm.spring.SSMCacheManager">
    <property name="caches">
        <set>
            <bean class="com.google.code.ssm.spring.SSMCache">
                <constructor-arg name="cache" index="0" ref="defaultCache"/>
                <!-- 5 minutes -->
                <constructor-arg name="expiration" index="1" value="0"/>
                <!-- @CacheEvict(..., "allEntries" = true) doesn't work -->
                <constructor-arg name="allowClear" index="2" value="false"/>
            </bean>
        </set>
    </property>

</bean>
<bean name="defaultCache" class="com.google.code.ssm.CacheFactory">
    <property name="cacheName" value="defaultCache"/>
    <property name="cacheClientFactory">
        <bean name="cacheClientFactory"  class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl"/>
    </property>
    <property name="addressProvider">
        <bean class="com.google.code.ssm.config.DefaultAddressProvider">
            <property name="address" value="127.0.0.1:11211"/>
        </bean>
    </property>
    <property name="configuration">
        <bean class="com.google.code.ssm.providers.CacheConfiguration">
            <property name="consistentHashing" value="true"/>
        </bean>
    </property>
  </bean>

我还将 simple-spring-memcached-3.5.0.jar 和 spymemcache.jar,spymemcache-provider.jar 添加到 lib 文件夹。但是当我运行我的项目时出现这个异常:

 Cannot find class **[net.nelz.simplesm.config.MemcachedClientFactory]** for bean with name 'memcachedClientFactory' defined in ServletContext resource [/WEB-INF/simplesm-context.xml]; nested exception is java.lang.ClassNotFoundException: net.nelz.simplesm.config.MemcachedClientFactory

最佳答案

你必须为这个类添加库。

关于java - 通过 memcache 集成的 spring mvc 中的这个错误是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26711096/

相关文章:

java - 使用 Jersey 在 Rest Api 中传递两个对象

java - Firebase "refer and earn"或使用奖励推荐的邀请?

java - Univocity - 使用 RowWriterProcessor 写出引号转义字符

java - 在 spring security 中从 userDetails 中排除 GrantedAuthority

jsp - 如何将对象传递给 View Spring MVC3

python - 禁用 python 文件的 Apache 缓存

caching - Cloudflare 是否支持 stale-while-revalidate?

Java Integer.parseInt 解析字符串失败

hibernate - Spring MVC Hibernate + SQLite 不创建数据库

ios - 如何缓存 UIViewControllers 以供 UICollectionViewCell 使用?