0

Spring コンテキストの定義に問題があります。この問題を抱えている他の人を見ると、通常は間違ったスキーマ宣言を使用していることが原因でしたが、私の問題には当てはまらないと思います。

Line 21 in XML document from ServletContext resource [/WEB-INF/spring/web-application-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 21; columnNumber: 67; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.

ここにxmlがあります

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

<!-- Imports the configurations of the different infrastructure systems of the application -->

<context:component-scan base-package="com.robert.login" />
<mvc:annotation-driven />
<import resource="webmvc-context.xml" />
<bean name="LoginInfo" class="com.robert.login.LoginInfo" />

</beans>

私はSpring-4.1.6を使用しています

4

1 に答える 1

1

これを修正する必要があると思います:

xmlns:context="http://www.springframework.org/schema/context/spring-context-4.1.xsd"

次のようにする必要があります。

xmlns:context="http://www.springframework.org/schema/context"
于 2015-06-05T19:33:55.450 に答える