Spring mvc Spring组件扫描错误(schema#u reference.4:未能读取schema文档';https://www.springframework.org/schema/beans/spring-beans-4.3.xsd')
我在eclipse中创建了一个没有maven的简单动态项目。只有在使用标记上下文:组件扫描时,我才会在Spring dispatcher文件中遇到以下错误:-Spring mvc Spring组件扫描错误(schema#u reference.4:未能读取schema文档';https://www.springframework.org/schema/beans/spring-beans-4.3.xsd'),spring-mvc,Spring Mvc,我在eclipse中创建了一个没有maven的简单动态项目。只有在使用标记上下文:组件扫描时,我才会在Spring dispatcher文件中遇到以下错误:- <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instan
<?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:context="http://www.springframework.org/schema/context"
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.xsd">
<context:component-scan base-package="com.example.controller"/>
</beans>
架构_引用。4:未能读取架构文档“”,因为1)找不到该文档;2) 文件无法读取;3) 根
文档的元素不可用
不确定从何处引用版本4.3。我使用的是SpringVersion5.0.0.RELEASE,并在lib中添加了所有JAR。以下是spring dispatcher文件的内容:-
<?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:context="http://www.springframework.org/schema/context"
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.xsd">
<context:component-scan base-package="com.example.controller"/>
</beans>
我找不到解决这个问题的方法。非常感谢您的帮助。解决此问题的可能性很大
- 最初您添加了..../spring-beans-4.3.xsd,然后删除了该版本,但仍然显示错误。这是因为eclipse正在从缓存中读取数据。尝试在prefences->General->Network->cache中删除缓存
- 即使您的项目不是maven,也可以右键单击该项目,转到属性并在构建路径中添加“maven依赖项”。这为我解决了一次类似的错误
- 如果以上两种方法不适用于您,请尝试复制粘贴此代码