SpirngMVC報錯 not declaration can be found for element ‘mvc:annotation-driven‘

2020-10-17 12:00:58

錯誤描述:

使用mvc標籤顯示不能識別

<mvc:annotation-driven conversion-service="ConversionService"/>

報錯:

he matching wildcard is strict,but not declaration can be found for element 'mvc:annotation-driven’

錯誤原因:

問題是不能識別"mvc:annotation-driven/"這個標籤,肯定是xml約束檔案引入的問題。修改引入的xml約束,新增約束:

xmlns:mvc="http://www.springframework.org/schema/mvc"

springmvc.xml頭模板

<?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">