元素 "context:component-scan" 的前缀 "context" 未绑定的解决方案
在动态web项目(Dynamic Web Project)中,使用SpringMVC框架,新建Spring的配置文件springmvc.xml,添加扫描控制器
<context:component-scan base-package="com.bwlu.controller"/>
显示红线

此时启动tomcat显示如下错误,元素 "context:component-scan" 的前缀 "context" 未绑定

解决方案:
1、在springmvc.xml中添加context的声明,添加后红线消失

此时启动tomcat,显示如下错误:通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明。

2、在xsi:schemaLocation实例中引用模式文档,指出模式文档的位置

完整代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- 扫描器 -->
<context:component-scan base-package="com.bwlu.controller"/>
<!-- 视图解析器 解析jsp视图 默认使用JSTL标签 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 配置jsp路径的前缀 -->
<property name="prefix" value="/WEB-INF/views/" />
<!-- 配置jsp路径的后缀 -->
<property name="suffix" value=".jsp" />
</bean>
</beans>
元素 "context:component-scan" 的前缀 "context" 未绑定的解决方案的更多相关文章
- context:component-scan" 的前缀 "context" 未绑定。
SpElUtilTest.testSpELLiteralExpressiontestSpELLiteralExpression(cn.zr.spring.spel.SpElUtilTest)org.s ...
- spring配置事务 元素 "tx:annotation-driven" 的前缀 "tx" 未绑定
在进行spring与mybatis整合时,启动项目报错,控制台提示“元素 "tx:annotation-driven" 的前缀 "tx" 未绑定”. 经过查找, ...
- cache:annotation-driven" 的前缀 "cache" 未绑定
问题: Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 29 in XML ...
- [Spring Boot] Use Component Scan to scan for Bean
Component Scan is important concept when we want to create Bean. Currently we know what, for the cla ...
- [转载]Context and Interception : The .NET Context
转载自:Context and Interception : The .NET Context Every new app domain starts with a single context, c ...
- Android在Context详细解释 ---- 你不知道Context
...
- spring注解注入:<context:component-scan>以及其中的context:include-filter>和 <context:exclude-filter>的是干什么的?
转自:https://www.cnblogs.com/vanl/p/5733655.html spring注解注入:<context:component-scan>使用说明 sprin ...
- 为什么applicationContext.xml和spring-servlet.xml中都有注解过滤<context:component-scan base-package="myproject"> 和<context:component-scan base-package="myproject.controller" />
在刚学习SpringMVC框架整合时,你也许会产生疑问为什么Spring.xml和SpringMVC.xml中都有注解过滤. <context:component-scan base-packa ...
- <context:component-scan>子标签:<context:include-filter>和<context:exclude-filter>使用时要注意的地方
在Spring MVC中的配置中一般会遇到这两个标签,作为<context:component-scan>的子标签出现. 但在使用时要注意一下几点: 1.在很多配置中一般都会吧Spring ...
随机推荐
- PID file found but no matching process was found. Stop aborted
一般脚本部署时不会遇到这种情况,有时候自个手动处理会出现”PID file found but no matching process was found. Stop aborted”,根据意思就可以 ...
- Unity3D delegate 用法
delegate:委托机制,不做一一说明: 功能需求1: 音量,为一事件为B: 改变音量如为0,为事件A.也触发事件B: 音量变,所有音乐,如场景,特效,角色,打斗.其所有音量都得变.为C: 思路: ...
- 关于java后台如何接收xml格式的数据
业务场景:用户发送下单请求,格式为xml格式,服务器接收数据完成下单,并返回结果给客户. 请求格式: <request> <head> <sign></sig ...
- POJ3090
Visible Lattice Points Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7094 Accepted: ...
- MVC5学习系列
前言 嗷~小弟我又出现了~咳咳..嚎过头了, 先说一说为什么写这个吧,~首先肯定是我自己需要学(废话 - -,)//,之前也写过MVC4的项目,嗯..但是仅限于使用并没有很深入的每个模块去了解, 这段 ...
- shell中${}的使用
1. 截断功能${file#*/}: 拿掉第一条/及其左边的字符串:dir1/dir2/dir3/my.file.txt${file##*/}: 拿掉最后一条/及其左边的字符串:my ...
- Event Scheduler
MySQL :: MySQL 5.7 Reference Manual :: 23.4 Using the Event Scheduler https://dev.mysql.com/doc/refm ...
- api xml database 设计一种数据库
w 问题 0-新增和读取,可以忽略更新和删除: 1-被请求方的xml dom结构多层且不定,且未来可能增删某些键(dom节点),且键值长度最值可能无法确定: 3-请求过程可能出现异常exception ...
- kubernetes 1.7.2 安装 记录过程
系统信息 cat /etc/redhat-release CentOS Linux release (Core) 环境信息 IP地址 主机名称 10.10.6.11 master 10.10.6.12 ...
- Overload and Override without Overwrite - Java
Override(覆盖/覆写): 子类Override父类中的函数(方法).Overload(重载): 同一个类中包含多个同名的函数(方法), 但各个函数的参数列表不同. Override和Overl ...