相信不少人都遇到过这种情况,提示spring 的xml文件找不到bean元素的声明。
Multiple annotations found at this line:
- cvc-elt.1: Cannot find the declaration of element 'beans'.
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-4.1.xsd', because 1) could not find the document; 2) the document could not be
read; 3) the root element of the document is not <xsd:schema>.
网上有好多办法,好多说是spring的版本不对,这是其中的一种情况。我的文件是直接在GitHub上down下来的,所以不是版本的问题,找了半天,发现原因是因为eclipse的验证机制出现的错误,直接将xml文件的验证关掉就可以解决这个问题。将xml文件相关的自动验证关闭,如下图