一、問題描述
使用spring jpa,報no declaration can be found for element 'jpa:repositories'錯誤的解決方案
multiple annotations found at this line:
- cvc-complex-type.2.4.c: the matching wildcard is strict, but no declaration can be found for element 'jpa:repositories'.
- schema_reference.4: failed to read schema document 'http://www.springframework.org/schema/data/jpa/spring-jpa.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配置檔案
二、解決方案
将http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
修改為
http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
并且加上如下兩名:
http://www.springframework.org/schema/data/repository
http://www.springframework.org/schema/data/repository/spring-repository-1.6.xsd
注意:
不添加後面兩句,會報:
referenced file contains errors (http://www.springframework.org/schema/data/jpa/spring-jpa-1.2.xsd). for more information, right click on the
message in the problems view and select "show details..."
三、原因分析:
<a href="http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">http://www.springframework.org/schema/data/jpa/spring-jpa.xsd</a>