xml - 元素 "context"的前缀 "context:component-scan"未绑定(bind)

标签 xml spring

我正在研究 spring3 mvc 并提出了这个错误

org.xml.sax.SAXParseException:元素“context:component-scan”的前缀“context”未绑定(bind)。

这是我的调度程序 servlet

<?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:p="http://www.springframework.org/schema/p"
    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-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

    <mvc:annotation-driven />

    <context:component-scan base-package="com.web" /> 

最佳答案

当您缺少 xmlns:context 声明但您已声明它时,就会出现这种类型的错误。检查您在 "com.web" 包中的类是否存在任何错误编码。

关于xml - 元素 "context"的前缀 "context:component-scan"未绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7131479/

相关文章:

python - 如何使用 Python 将命名空间和前缀插入到 XML 字符串中?

xml - xpath 其所有子元素名称都相同的父级

spring - 使用 spring boot 配置多个 servletcontainers/servlet

python - 在Linux桌面上显示实时记分卡

php - 如何通过 SimpleXML 访问自定义 XML 元素

java - 自定义主题启动时应用程序崩溃

java - 如何更改Spring Cloud GCP的依赖版本

java - 具有多个用户 OU 和多个访问 CN 的 Spring LDAP 身份验证

java - 如何在 Java Spring 应用程序中提交 myBatis 更新语句?

java - Spring:如何获取bean层次结构?