使用Idea构建springmvc框架,出现no bean named 'cacheManager' is defined 错误

由于IDEA的自动补全功能非常强大,当你配置 <mvc:annotation-driven/> 
后编译器会帮你自动补全上面两个配置文件约束。这个时候如果你没注意的就会爆出一个很莫名奇妙的错:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘cacheManager’ is defined

IDEA会帮我们自动补全Cache,,但配置文件中又没有指定缓存的空间,JVM虚拟机中也有个cacheManage,

这就导致spring进行bean管理时扫描到两个cache Manage 导致都不能正常加载,将其注释掉即可。

<!--    xmlns:mvc="http://www.springframework.org/schema/cache"-->
<!-- http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd-->

 

 

 

posted @ 2019-08-31 20:42  y-xs  阅读(625)  评论(0编辑  收藏  举报