通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明

这一点有些奇怪,我的开发环境是Spring 4.3.2.Release版本,关于context的xml的约束位置的声明,要指定清楚,才能避免标题中提及的错误。

而其他的xsi:schemaLocation,比如jdbc等就不需要,默认就是当前版本,正确的。

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jdbc="http://www.springframework.org/schema/jdbc"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/jdbc
            http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context-4.3.xsd">

Spring-context

猜你喜欢

转载自blog.csdn.net/u011730792/article/details/79131588