昨天搭ssm框架时,遇到上面的异常,一脸懵比,我没用过这个bean啊,后来度娘找到了解决方法,是mvc的配置文件
<mvc:annotation-driven/>
,idea自动导入命名空间时出现了问题,导成了↓(含 cache) 这种,删除掉重新导入就行了。
1. <beans xmln="http://www.springframework.org/schema/beans"
2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3. xmlns:context="http://www.springframework.org/schema/context"
4. <span style="color:#ff0000;"> xmlns:mvc="http://www.springframework.org/schema/cache"</span>
5. 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 <span style="color:#ff0000;">http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd</span>">
正确的命名空间是↓ 这种:
<beans xmlns="http://www.springframework.org/schema/beans"标签:www,http,creating,CacheInterceptor,cache,springframework,context,org,schema From: https://blog.51cto.com/u_15882671/5871548
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">