2015-06-05 2 views
0

У меня проблема с определениями Spring-contex. Когда я смотрю на других людей, у которых была эта проблема, обычно это было связано с неправильным назначением схем, но я не думаю, что это относится к моей проблеме.Контекст: компонентное сканирование не может быть определено

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> 

Я использую Весна-4.1.6

ответ

1

Я думаю, что вам нужно, чтобы исправить это:

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

Должно быть:

xmlns:context="http://www.springframework.org/schema/context" 
+0

Да, все. –