Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'异常解决方案

解决方案:

<?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:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/mvc
       http://www.springframework.org/schema/mvc/spring-mvc.xsd">

错误原因1:

http://www.springframework.org/schema/mvc/spring-mvc.xsd这个
之前IDEA在spring-mvc后面自动加了版本号(好像是3.1.2),删了就可以了

 错误原因2:

  有关mvc的包选择错了,当时IDEA自动导入了

http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd

把这两个换成
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd

就可以了

Error creating bean with name 'org.springframework.cache.interceptor.CacheInterceptor#0’


spring配置文件添加注解扫描<mvc:annotation-driven />之后,idea会自动给你添加引用,但是它添加的引用是xmlns:mvc=”http://www.springframework.org/schema/cache”,这就导致了问题。应该把它改成xmlns:mvc=”http://www.springframework.org/schema/mvc”

 
posted @ 2020-06-20 07:28  青衫客36  阅读(1749)  评论(0编辑  收藏  举报