全局CORS过滤器给出错误

时间:2018-07-15 15:48:19

标签: spring-mvc cors

我正在 dispatcher-servlet.xml

中使用 CORS过滤器

我的 dispatcher-servlet.xml

<?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"
    xmlns:context="http://www.springframework.org/schema/context"
    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">


    <context:component-scan base-package="com.mindtree" />

    <mvc:annotation-driven />

    <mvc:cors>
        <mvc:mapping path="/*"
            allowed-origins="*"
            allowed-methods="POST, GET, PUT, DELETE"
            allowed-headers="Content-Type"
            exposed-headers="header-1, header-2"
            allow-credentials="false"
            max-age="6000" />
    </mvc:cors>
</beans>

在运行应用程序时,出现以下错误

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:cors'.

0 个答案:

没有答案