在使用注解的方式配置bean遇到如下问题。
Referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans-4.3.xsd).
For more information, right click on the message in the Problems View and select "Show Details..."
Spring是使用 maven 配置的4.3.13版本。
解决方式一 :
schemaLocation的xsd约束加上当前版本号,我的是4.3版本,改为如下约束 。其余约束也最好加上版本号。
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
如图错误消失:
解决方式二:
我的是MyEclipse 2017 并没有一下解决方式
Progect –>clean
Preferences -> General -> Network Connections -> Cache
Preferences > XML > XML Files > Validation中”Honour all XML schema locations
解决方式如图 :
该方式是取消xml文件的约束验证。
后面的setting方式可以设置相关的rules,不得其然也,如有大佬知道,还请指点。
附约束:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
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
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
</beans>