Spring使用mvc:resources提供静态内容,无效的xsd [英] Spring serving static content with mvc:resources, invalid xsd

查看:125
本文介绍了Spring使用mvc:resources提供静态内容,无效的xsd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

As recommended by http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-static-resources I wish to use <mvc:resources> for serving my spring static content.

我尝试了以下XML,但是.xsd文件不包含<mvc:resources>的声明,因此找不到替代的.xsd.我可以忽略eclipse错误,但是由于SAXParseException,服务器将无法启动.

I have tried the following XML, but the .xsd file doesn't contain a declaration for <mvc:resources> and I cannot find an alternative .xsd. I can ignore the eclipse error, but the server won't start because of a SAXParseException.

我哪里出错了?

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

    <mvc:resources mapping="/css/**" location="/css/"/>

</beans>

推荐答案

<mvc:resources>中的属性是在Spring 3.0.4 中添加的.

Attributes in <mvc:resources> were added in Spring 3.0.4.

编辑:即,您只需将Spring 3.0.4添加到您的依赖项中,一切就可以正常工作(Eclipse插件中的错误标记除外).在运行时,Spring会自动解析配置文件,因此将使用Spring内置的XSD文件.

EDIT That is: you just add Spring 3.0.4 to your dependencies and everything works fine (except error marks in Eclipse plugin). At runtime config files are parsed by Spring itself, therefore Spring's built-in XSD file is used.

这篇关于Spring使用mvc:resources提供静态内容,无效的xsd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆