无法将名称'repository:repositories'解析为(n)'type definition'组件

时间:2015-05-30 06:01:47

标签: java spring xsd namespaces spring-data-jpa

编写applicationContext.xml时遇到异常:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 18 in XML document from class path resource [META-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/data/jpa/spring-jpa.xsd; lineNumber: 18; columnNumber: 51; src-resolve: Cannot resolve the name 'repository:repositories' to a(n) 'type definition' component.

经过几次尝试后我终于发现问题是存储库:存储库位于spring-jpa.xsd:

<xsd:extension base="repository:repositories">
<xsd:attributeGroup ref="repository:transactional-repository-attributes"/>
<xsd:attribute name="entity-manager-factory-ref" type="entityManagerFactoryRef"/>
<xsd:attribute name="enable-default-transactions" type="xsd:boolean">
<xsd:annotation><xsd:documentation>
                                Controls whether repositories get transactions enabled by default. 
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>

经过粗略的研究后我认为这引用了spring-repository.xsd所以我想我的程序根本找不到spring-repository.xsd的方法

<xsd:complexType name="repositories">
<xsd:sequence>
...omitted..
</xsd:sequence>
</xsd:complexType>

我知道当程序试图获取http://www.springframework.org/schema/data/jpa/spring-jpa.xsd时,它会转到spring-data-jpa.jar(我发现spring-jpa-1.8.xsd位于包org.springframework.data.jpa中.repository.config),但我想知道这个repository.xsd在哪里找到?我怎样才能确保sping-jpa.xsd尝试引用repository.xsd时它是否成功?

提前致谢

0 个答案:

没有答案