我想启用矩阵变量,但它会显示消息

时间:2014-11-03 07:27:42

标签: java spring-mvc

"<mvc:annotation-driven enable-matrix-variables="true"/>    
   <context:component-scan base-package="Controllers" />"

它给我以下错误消息:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 18 in XML document from ServletContext resource [/WEB-INF/appDispatcher-servlet.xml] is invalid;
nested exception is org.xml.sax.SAXParseException; lineNumber: 18; columnNumber: 59; cvc-complex-type.3.2.2: Attribute 'enable-matrix-variables' is not allowed to appear in element 'mvc:annotation-driven'.

1 个答案:

答案 0 :(得分:1)

我可以确认Spring 3.2下的正确写作是<mvc:annotation-driven enableMatrixVariables="true" >

以下是Spring Framework 3.2.4的工作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:util="http://www.springframework.org/schema/util"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:c="http://www.springframework.org/schema/c"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">

    <mvc:annotation-driven enableMatrixVariables="true" >

请注意对3.2模式的引用