1. Caused by: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 60; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.
多半是配置文件缺少鏈接找不到資源引起的,或是springmvc 版本和xsd版本不一致引起的.
idea新建的springMvc 工程,參考 https://blog.csdn.net/love_java_cc/article/details/76359815#commentBox
javaweb三層架構和mvc架構、生成的配置文件,有
xmlns:context="http://www.springframework.org/schema/context"
我在下文中增加了
<context:component-scan base-package="com.spring.mvc"/>
就出錯了,還需要還需要添加 URL
在dispatchcher-sevlet.xml 中增加
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
就能運行成功.