Description Resource Path Location Type cvc-complex-type.2.4.c

完整错误报告

Description Resource Path Location Type
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element ‘context:component-scan’. spring.xml /spring-study/src/main/resources line 17 XML Problem
在这里插入图片描述

方法1:把对应的XML头部换掉成下面这个即可(看方法2)

<?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:mvc="http://www.springframework.org/schema/mvc"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
		http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
		http://www.springframework.org/schema/mvc 
		http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd 
		http://www.springframework.org/schema/context 
		http://www.springframework.org/schema/context/spring-context-4.0.xsd 
		http://www.springframework.org/schema/aop 
		http://www.springframework.org/schema/aop/spring-aop-4.0.xsd 
		http://www.springframework.org/schema/tx 
		http://www.springframework.org/schema/tx/spring-tx-4.0.xsd ">

方法2:关闭Eclipse的xml自动校验

由于eclipse会自动校验xml,该错误是定义schema的xml没有下载好,也许是网络问题,也许只是校验卡了。

只需要做以下步骤就可消除红叉叉!!

window—>Preferences—>Validation—>diabled All即可

在这里插入图片描述

发布了53 篇原创文章 · 获赞 0 · 访问量 4158

猜你喜欢

转载自blog.csdn.net/qq_36453423/article/details/103469090