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