用myeclipse2016写代码,使用注解开发时,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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
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.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- 注解驱动包含了注解的处理器映射器和处理器适配器的配置 -->
<mvc:annotation-driven></mvc:annotation-driven>
<!-- 组件扫描会扫描指定包路径下的含有controller注解的类 -->
<context:component-scan base-package="controller"></context:component-scan>
<!-- 处理器视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"></bean>
</beans>
第19行错误
Multiple annotations found at this line:
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:annotation-driven'.
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/mvc/spring-mvc.xsd', because 1) could not
find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.