前缀“上下文"指的是“上下文".对于元素"context:component-scan"没有约束 [英] The prefix "context" for element "context:component-scan" is not bound

查看:77
本文介绍了前缀“上下文"指的是“上下文".对于元素"context:component-scan"没有约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理spring3 mvc,并遇到此错误

I am working on spring3 mvc and came up with this error

org.xml.sax.SAXParseException:元素"context:component-scan"的前缀"context"未绑定.

org.xml.sax.SAXParseException: The prefix "context" for element "context:component-scan" is not bound.

这是我的调度程序servlet

Here is my dispatcher 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"包中的类是否有错误的编码.

Such type of error comes when You're missing the xmlns:context declaration but you have declared it. Check your classes in "com.web" package for any wrong coding.

这篇关于前缀“上下文"指的是“上下文".对于元素"context:component-scan"没有约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆