【java】通配符的匹配很全面, 但无法找到元素 ‘mvc:annotation-driven‘ 的声明

原xml配置写法如下: 

报错前是没有加最后两句beans的注释的  加上之后就OK了

 

正确配置如下,否则还会出现其他诡异报错提示,比如:

SAXParseException; lineNumber: 8; columnNumber: 77; cvc-elt.1: 找不到元素 ‘beans‘ 的声明。

<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
       https://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/mvc
       https://www.springframework.org/schema/mvc/spring-mvc.xsd">

 

参考自:https://blog.csdn.net/qq_43291207/article/details/115004206

 

posted @ 2022-06-05 10:12  狼窝窝  阅读(113)  评论(0)    收藏  举报