「mvc:annotation-driven」能夠換成任何xml標籤,spring
發生錯誤時的配置以下:spring-mvc
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
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.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd ">mvc
這個錯誤的根本緣由在於,spring容器啓動時,XmlBeanDefinitionReader類既沒法經過spring的jar包的META-INFO/spring.schemas文件的映射到jar包中的相應的的xsd文件,又沒法經過聯網直接從http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd地址讀取到相應的xsd文件。xml