SpringMVC:通配符的匹配很全面, 但无法找到元素 ‘context:component-scan‘ 的声明
问题描述
配置servlet.xml配置文件时,出现通配符的匹配很全面, 但无法找到元素 ‘context:component-scan’ 的声明报错。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns="http://www.springframework.org/schema/beans"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ><context:component-scan base-package="com.anonymity.controller"/><bean id="viewResolver" class="org.thymeleaf.spring5.view.ThymeleafViewResolver"><property name="order" value="1"/><property name="characterEncoding" value="UTF-8"/><property name="templateEngine"><bean class="org.thymeleaf.spring5.SpringTemplateEngine"><property name="templateResolver"><bean class="org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver"><property name="prefix" value="/WEB-INF/templates/"/><property name="suffix" value=".jsp"/><property name="templateMode" value="HTML5"/><property name="characterEncoding" value="UTF-8"/></bean></property></bean></property></bean>
</beans>
解决方案
经过与其他工程的对比后,发现xsi:schemaLocation内容缺少。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns="http://www.springframework.org/schema/beans"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd"><context:component-scan base-package="com.anonymity.controller"/><bean id="viewResolver" class="org.thymeleaf.spring5.view.ThymeleafViewResolver"><property name="order" value="1"/><property name="characterEncoding" value="UTF-8"/><property name="templateEngine"><bean class="org.thymeleaf.spring5.SpringTemplateEngine"><property name="templateResolver"><bean class="org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver"><property name="prefix" value="/WEB-INF/templates/"/><property name="suffix" value=".jsp"/><property name="templateMode" value="HTML5"/><property name="characterEncoding" value="UTF-8"/></bean></property></bean></property></bean>
</beans>
SpringMVC:通配符的匹配很全面, 但无法找到元素 ‘context:component-scan‘ 的声明相关推荐
- Spring配置文件报错 :通配符的匹配很全面, 但无法找到元素 ‘context:property-placeholder‘ 的声明
在Spring导入连接数据库的配置文件的时候,使用idea创建配置文件有时候会报XmlBeanDefinitionStoreException异常. <?xml version="1. ...
- vc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 ‘context:property-placeholder‘ 的声明。
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from c ...
- 通配符的匹配很全面, 但无法找到元素 'tx:annotation-driven' 的声明
启动Tomcat时报错,通配符的匹配很全面, 但无法找到元素 'tx:annotation-driven' 的声明,报错如下 1.从报错可以看到找不到元素 tx:annotation-driven ...
- “通配符的匹配很全面, 但无法找到元素 ‘utillist‘ 的声明”的问题
"通配符的匹配很全面, 但无法找到元素 'util:list' 的声明"的问题 报错: Exception in thread "main" org.sprin ...
- 通配符的匹配很全面, 但无法找到元素 'mvc:annotation-driven' 的声明
查看全文 http://www.taodudu.cc/news/show-1021075.html 相关文章: [算法设计与分析]05 有关函数的渐进的界的定理 [算法设计与分析]06 几类重要的函数 ...
- idea dubbo jar error:cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'dubbo:application' 的声明...
声明: 出现这个错误的情形是,在idea开发环境里面运行是没有问题的,使用哦idea自带的打包工具生成jar之后,运行jar的时候报的这个错误,如果不是这个情况,这篇文章可能不适用. 主要的原因是sp ...
- 匹配的通配符很全面,但无法找到元素mvc:annotation-driven的声明
目录 前言 1. 错误重现 2. 解决问题 3. 一些思考 前言 本篇文章的来源是遇到的一个奇葩的问题,springmvc 部署之后,出现"匹配的通配符很全面,但无法找到元素 mvc:a ...
- ACL 通配符掩码 匹配的范围计算及理解
例题 access-list 120 permit ip 10.0.0.0 0.0.0.191 any 这条ACL看似简单,却又复杂,因为正常我们见到的通配符掩码都是诸如0.0.0.255(255.2 ...
- jquery简单原则器(匹配索引为指定值的元素)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
最新文章
- MapXtreme 2005 学习心得 在地图上创建点/线并显示标注(五)
- TLD(Tracking-Learning-Detection)学习与源码理解之(二)
- 【SICP练习】79 练习2.51
- 随想录(程序员和收入)
- Oracle修改SID(实例名)
- js学习小计6-慎用return false;
- excel求回归直线方程的公式,excel2007用于拟合数据曲线方程,回归分析,趋势线...
- Extjs之EditorGridPanel的beforeedit事件参数
- 输入圆半径 计算 直径 周长 面积
- 通过Python爬取必应壁纸,学XPath
- pyqt5 等待界面 (QMovie 加载 gif)
- 【海康威视】相关名词术语产品注解
- Bluetooth sco协议录音
- Vue国际化处理 vue-i18n 以及项目自动切换中英文
- OpenCV特征点检测------Surf(特征点篇)
- 基于python的AI五子棋实现(极大极小值搜索和alpha beta剪枝)
- BOM--系统对话框
- 关于相机飞拍和IO板卡触发拍照
- 多元线性回归——《应用回归分析R语言版》
- 应届生必备简历模板,分享