我正在研究 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/