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”

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM