Spring数据neo4j的Cineasts示例错误 [英] Errors of the Cineasts examples of Spring data neo4j

查看:109
本文介绍了Spring数据neo4j的Cineasts示例错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我导入了 cineast 使maven项目黯然失色,但我遇到了配置问题...

I imported the cineast maven project to eclipse, but I face a configuration problem...

cvc-complex-type.4: Attribute 'base-package' must appear on element 'neo4j:config'

下面是有此错误的配置文件.

Below are the configuration files which have this error.

ApplicationContext.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
       xmlns:tx="http://www.springframework.org/schema/tx"
       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/data/neo4j http://www.springframework.org/schema/data/neo4j/spring-neo4j.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">

    <context:annotation-config/>
    <context:component-scan base-package="org.neo4j.cineasts">
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>

    <context:spring-configured/>

    <neo4j:config storeDirectory="target/data/graph.db"/>
    <neo4j:repositories base-package="org.neo4j.cineasts.repository"/>

    <!--neo4j:config graphDatabaseService="graphDatabaseService"/>
    <bean id="graphDatabaseService" class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase">
        <constructor-arg value="http://localhost:7474"/>
    </bean-->

    <bean class="org.neo4j.cineasts.movieimport.MovieDbApiClient">
        <constructor-arg value="926d2a79e82920b62f03b1cb57e532e6"/>
    </bean>
    <bean class="org.neo4j.cineasts.movieimport.MovieDbLocalStorage">
        <constructor-arg value="data/json"/>
    </bean>

    <tx:annotation-driven mode="proxy"/>

</beans>

movie-test-context.xml

movie-test-context.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
       xmlns:tx="http://www.springframework.org/schema/tx"
       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/data/neo4j http://www.springframework.org/schema/data/neo4j/spring-neo4j.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">

    <context:annotation-config/>
    <context:spring-configured/>
    <context:component-scan base-package="org.neo4j.cineasts"/>

    <neo4j:config graphDatabaseService="graphDatabaseService"/>
    <neo4j:repositories base-package="org.neo4j.cineasts.repository"/>

    <bean id="graphDatabaseService" class="org.neo4j.test.ImpermanentGraphDatabase" destroy-method="shutdown"/>

    <bean class="org.neo4j.cineasts.movieimport.MovieDbApiClient">
        <constructor-arg value="926d2a79e82920b62f03b1cb57e532e6"/>
    </bean>
    <bean class="org.neo4j.cineasts.movieimport.MovieDbLocalStorage">
        <constructor-arg value="data/json"/>
    </bean>
    <tx:annotation-driven mode="proxy"/>
</beans>

推荐答案

看看这实际上是早期Stack上的一个重复问题,但是总的来说,如果您使用的是最新的SDN(并且我很确定您使用的是SDN),那么您需要包括基本包" 属性同时位于neo4j:config和neo4j:repositories元素中.

This is actually a duplicate question from earlier on Stack, but, long and short is that if you're using the latest SDN (and I'm pretty sure you are), then you need to include the "base-package" attribute in both the neo4j:config and neo4j:repositories elements.

在上面的链接中,Michael Hunger对此进行了解释,您可以清楚地看到这些属性的值是什么.

In the link above, Michael Hunger explains this and you can clearly see what the values for those attributes should be.

HTH

这篇关于Spring数据neo4j的Cineasts示例错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆