Spring 的配置文件中,有一个配置文件头:spring
< beans xmlns =”http://www.springframework.org/schema/beans” xsi:schemaLocation =” http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd” >
这代表,在当前配置文件中,使用的是beans命名空间,能够直接使用<bean id=”">。spring-mvc
若是要在这个配置文件中使用mvc命名空间下的annotation-driven元素,要写为<mvc:annotation-driven/>,固然,还须要告诉xml解析器,mvc这个命名空间是在哪里定义的,以便解析器可以验证当前文件中mvc:开头的元素是否符合mvc命名空间的:mvc
< beans xmlns =”http://www.springframework.org/schema/beans” xmlns:mvc =”http://www.springframework.org/schema/mvc” xsi:schemaLocation =” http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd” >
这样解析器在解释mvc:命名空间的时候,会参考spring-mvc-3.0.xsd这个文件来检验<mvc:annotation-driven/>是否合格。spa