搭建ssm的踩坑之路(三)找不到EhCacheManagerFactoryBean

时间:2024-05-21 20:29:43

继续上一篇https://blog.****.net/sky_jiangcheng/article/details/86513900,搭建ssm项目过程中,配置缓存管理(cacheManager)之后,

<bean id="ehCacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
        <property name="configLocation" value="classpath:ehcache.xml" />
        <property name="shared" value="true"/>
    </bean>

    <!-- 开启spring缓存 -->
    <cache:annotation-driven cache-manager="cacheManager" />
    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
        <property name="cacheManager" ref="ehCacheManager"></property>
    </bean>

报找不到 org.springframework.cache.ehcache.EhCacheManagerFactoryBean,然后我就发现 cache 目录在 spring-context 的包下,该包下没有ehcache目录,如图显示找不到对应的类

搭建ssm的踩坑之路(三)找不到EhCacheManagerFactoryBean

cache进入了context包 如图

搭建ssm的踩坑之路(三)找不到EhCacheManagerFactoryBean

判断是缺少了包,经过搜索找到了原来是缺少 spring-context-support 包

解决方案:

1,添加依赖

<dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-context-support</artifactId>
          <version>${spring.version}</version>
      </dependency>

更新maven仓库 顺利运行