java - 我想启用矩阵变量,但它显示了消息

标签 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'.

最佳答案

我可以确认 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 模式的引用

关于java - 我想启用矩阵变量,但它显示了消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26709610/

相关文章:

java - Spring MVC - 在多部分 HTTP Post 中获取非多部分表单/数据

java - 在类似运算符上应用字符串列表

java - ftp 上的同时连接数

java.lang.ClassNotFoundException : org. springframework.web.servlet.DispatcherServlet [/SpringmvcDemo] 抛出 load() 异常

maven - 本地主机和远程服务器(Tomcat)上的war文件部署之间的区别

java - 如何在 Web 服务响应中将 json 响应作为 block 返回?

java - @ControllerAdvice 在处理异常方面比 @ExceptionHandler 或 HandlerExceptionResolver 有什么优势?

java - 如何在 Spring security 中编辑定时注销

java - java关闭连接怎么写?

java - Gson 反序列化 :Json Field Name Different from Java Object Field Name