Line 66 in XML document from URL [jar:/webapps/ROOT/WEB-INF/lib/user-service-1.0-SNAPSHOT.jar!/spring/spring-mybatis.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 66; columnNumber: 70; cvc-complex-type.2.4.c: 'context:component-scan'
context:component-scan一直显示spring的注解扫描器有问题
这个错误主要是应为少包了,beans节点的xsi:schemaLocation属性值漏了
在spring的核心配置文件上面引入下面即可
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
赋一个完整的配置
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" 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.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/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/srchema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.spingframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">