相关疑难解决方法(0)

匹配的通配符是严格的,但是没有为元素'context:component-scan'找到声明

我正在使用带有maven的Spring 3.2.3.RELEASE来提取依赖项.在Eclipse中构建项目时出现以下错误:

Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 17 in XML document from class path resource [META-INF/spring/application-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 64; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.
Run Code Online (Sandbox Code Playgroud)

我的appication-context.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"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
    http://www.springframework.org/schema/context/
  http://www.springframework.org/schema/context/spring-context-3.2.xsd">

  <context:component-scan base-package="com.example" />
Run Code Online (Sandbox Code Playgroud)

我知道我正在提取正确的jar文件,因为我的Maven依赖项显示:

Eclipse Maven依赖项

在META-INF/sping.schemas中,我可以看到我的jar中有正确的模式声明:

http\://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd
http\://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd
http\://www.springframework.org/schema/context/spring-context-3.1.xsd=org/springframework/context/config/spring-context-3.1.xsd
http\://www.springframework.org/schema/context/spring-context-3.2.xsd=org/springframework/context/config/spring-context-3.2.xsd
http\://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.2.xsd
Run Code Online (Sandbox Code Playgroud)

我也看了这些无济于事:

无法加载spring 3架构

匹配的通配符是严格的,但是找不到元素'tx:annotation-driven'的声明

元素'context:component-scan'没有声明

匹配的通配符是严格的,但是找不到元素'context:component-scan的声明

请帮忙,这让我发疯了...... :(

spring

6
推荐指数
1
解决办法
2万
查看次数

网上不再提供Spring Beans Schema?

在我的浏览器中访问http://www.springframework.org/schema/beans/spring-beans-3.1.xsd会产生403.

在浏览器中访问http://www.springframework.org/schema/security/spring-security-3.1.xsd会返回有效的架构...

那我错过了什么?这是暂时的问题吗?或者将bean模式移动到其他地方?

java spring

5
推荐指数
1
解决办法
3325
查看次数

标签 统计

spring ×2

java ×1