2016-11-16 112 views
-1

我完全是一个noob,我试图按照春季初学者指南。在调度程序servlet声明(名为DefaulServlet)中,我得到这个错误:cvc-complex-type.2.4.c:匹配通配符是严格的,但是对于元素上下文组件扫描没有发现声明。Spring MVC - 没有声明可以找到

在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:mvc="http://www.springframework.org/schema/mvc" 
     xmlns:context="http://www.spingframework.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-4.3.xsd 
          http://www.springframework.org/schema/mvc 
          http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd"> 
    <mvc:annotation-driven /> 
    <context:component-scan base-package="com.packt.webstore" /> 

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
    <property name="prefix" value="/WEB-INF/jsp/" /> 
    <property name="suffix" value=".jsp" /> 
    </bean> 
</beans> 

该项目的Maven依赖是:

spring-webmvc-4.3.3.RELEASE 
spring-aop-4.3.3.RELEASE 
spring-beans-4.3.3.RELEASE 
spring-context-4.3.3.RELEASE 
spring-core-4.3.3.RELEASE 
commons-logging-1.2 
spring-expression-4.3.3.RELEASE 
spring-web-4.3.3.RELEASE 
jstl-1.2 
javax.servlet-api-3.1.0 

我真的被困在这里。请帮帮我。

+1

hey here [匹配通配符是严格的,但没有声明可以找到元素的上下文:组件扫描](http://stackoverflow.com/questions/13589470/the-matching-wildcard-is-strict-但是没有声明可以找到元素co) –

回答

0

我使用像你一样的春季版本和同样的问题。经过长期的研究后,我发现这一点:

Code Working

抱歉,但我的小声誉,我不能把代码中的文本。 最好的问候。

+0

请** **您的文章,并显示实际的代码为文本,而不是截图。其他人不能从你的图像复制和粘贴。详细信息请参见此处(http://meta.stackoverflow.com/a/285557/1402846)。请阅读[本帮助中心页面](http://stackoverflow.com/editing-help)了解如何格式化您的代码。谢谢。 – Pang

相关问题