问题描述

配置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‘ 的声明相关推荐

  1. Spring配置文件报错 :通配符的匹配很全面, 但无法找到元素 ‘context:property-placeholder‘ 的声明

    在Spring导入连接数据库的配置文件的时候,使用idea创建配置文件有时候会报XmlBeanDefinitionStoreException异常. <?xml version="1. ...

  2. vc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 ‘context:property-placeholder‘ 的声明。

    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from c ...

  3. 通配符的匹配很全面, 但无法找到元素 'tx:annotation-driven' 的声明

    启动Tomcat时报错,通配符的匹配很全面, 但无法找到元素 'tx:annotation-driven' 的声明,报错如下 1.从报错可以看到找不到元素   tx:annotation-driven ...

  4. “通配符的匹配很全面, 但无法找到元素 ‘utillist‘ 的声明”的问题

    "通配符的匹配很全面, 但无法找到元素 'util:list' 的声明"的问题 报错: Exception in thread "main" org.sprin ...

  5. 通配符的匹配很全面, 但无法找到元素 'mvc:annotation-driven' 的声明

    查看全文 http://www.taodudu.cc/news/show-1021075.html 相关文章: [算法设计与分析]05 有关函数的渐进的界的定理 [算法设计与分析]06 几类重要的函数 ...

  6. idea dubbo jar error:cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'dubbo:application' 的声明...

    声明: 出现这个错误的情形是,在idea开发环境里面运行是没有问题的,使用哦idea自带的打包工具生成jar之后,运行jar的时候报的这个错误,如果不是这个情况,这篇文章可能不适用. 主要的原因是sp ...

  7. 匹配的通配符很全面,但无法找到元素mvc:annotation-driven的声明

    目录 前言 1. 错误重现 2. 解决问题 3. 一些思考 前言   本篇文章的来源是遇到的一个奇葩的问题,springmvc 部署之后,出现"匹配的通配符很全面,但无法找到元素 mvc:a ...

  8. ACL 通配符掩码 匹配的范围计算及理解

    例题 access-list 120 permit ip 10.0.0.0 0.0.0.191 any 这条ACL看似简单,却又复杂,因为正常我们见到的通配符掩码都是诸如0.0.0.255(255.2 ...

  9. jquery简单原则器(匹配索引为指定值的元素)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

最新文章

  1. MapXtreme 2005 学习心得 在地图上创建点/线并显示标注(五)
  2. TLD(Tracking-Learning-Detection)学习与源码理解之(二)
  3. 【SICP练习】79 练习2.51
  4. 随想录(程序员和收入)
  5. Oracle修改SID(实例名)
  6. js学习小计6-慎用return false;
  7. excel求回归直线方程的公式,excel2007用于拟合数据曲线方程,回归分析,趋势线...
  8. Extjs之EditorGridPanel的beforeedit事件参数
  9. 输入圆半径 计算 直径 周长 面积
  10. 通过Python爬取必应壁纸,学XPath
  11. pyqt5 等待界面 (QMovie 加载 gif)
  12. 【海康威视】相关名词术语产品注解
  13. Bluetooth sco协议录音
  14. Vue国际化处理 vue-i18n 以及项目自动切换中英文
  15. OpenCV特征点检测------Surf(特征点篇)
  16. 基于python的AI五子棋实现(极大极小值搜索和alpha beta剪枝)
  17. BOM--系统对话框
  18. 关于相机飞拍和IO板卡触发拍照
  19. 多元线性回归——《应用回归分析R语言版》
  20. 应届生必备简历模板,分享

热门文章

  1. Vue3.x动态路由、命名路由和编程式导航
  2. 基于PyQT5实现垃圾分类小程序
  3. 南通五年制计算机大专学校,南通比较好的五年制的大专有哪些
  4. vue-amap添加某个省市县区的边界线,添加某个省市县区的行政区划
  5. JAVA一次性读取Mysql几十万条大数据的处理
  6. hopper_零到150万编码人员:构建蚱hopper时吸取的九个教训
  7. html 动态背景css 蜘蛛网背景
  8. 写在2014年7月2日
  9. 白噪声估值器及其在信号处理中的应用
  10. Docker容器管理之Dockercompose.yml文件格式说明