元素 "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 ...
随机推荐
- Jmeter做读取csv接口测试
最近在工作中,对jmeter实践的点滴的记录这里分享,不一定正确,仅供参考和讨论,有想法的欢迎留言.谈论. 1技巧1:从csv中获取带引号的数据详情 背景:我们从csv中获取数据,在jmeter中使用 ...
- Yii 2 的安装 之 踩坑历程
由于刚接触yii2 ,决定先装个试试:可是这一路安装差点整吐血,可能还是水平有限吧, 但还是想把这个过程分享出来,让遇到同样问题的同学有个小小的参考,好了言归正传!! <(~.~)> 下 ...
- Java的版本历史与特性
一个比较流行的问题是,“Java下一个版本会有什么特性呢?” .这是否是个好问题却有待商榷.在下面的内容里,我总结了至今为止的Java主要发行版中各自引入的新特性,这样做的目的是为了突出各个新特性是在 ...
- linux磁盘清理
一.背景: 1.由于linux系统空间是由挂载磁盘得来的,但有时装系统时挂载/根目录空间不大,现仅清除用户下载的大文件 二.方法: 1.输入命令df -h显示当前磁盘挂载(包含剩余空间)情况这里写图片 ...
- python系列十一:python3数据结构
#!/usr/bin/python #Python3 数据结构'''Python中列表是可变的,这是它区别于字符串和元组的最重要的特点,一句话概括即:列表可以修改,而字符串和元组不能.''' '''将 ...
- C#反射Assembly 详细说明(转)
1.对C#反射机制的理解2.概念理解后,必须找到方法去完成,给出管理的主要语法3.最终给出实用的例子,反射出来dll中的方法 反射是一个程序集发现及运行的过程,通过反射可以得到*.exe或*.dll等 ...
- 关于服务器jdk版本和代码编译调试兼容问题
首先代码是基于哪个版本编写和调试,有没有用到新版本jdk新的特性,类啊接口啊啥的,用到了的话,就不行了 其他都共有的是向下兼容的 最好开发环境的jdk版本和部署环境的jdk版本匹配.
- Debussy的安装与使用
1.概述 Debussy是NOVAS Software, Inc ( 思源科技 )发展的HDL Debug & Analysis tool,这套软体主要不是用来跑模拟或看波形,它最强大的功能是 ...
- redis3.2.11单机多实例集群部署并测试连接情况
配置准备: redis3.2.11安装配置规划 机器 192.168.169.135(本机虚拟机) 系统 Red Hat Enterprise Linux Server release 6.4 (Sa ...
- mysql数据库补充知识1 安装数据库破解数据库密码已经创建用户
一.安装MYSQL数据库 1.yum安装 #二进制rpm包安装 yum -y install mysql-server mysql 2.源码安装 1.解压tar包 cd /software tar ...