Errors of the Cineasts examples of Spring data neo4j

亡梦爱人 提交于 2020-01-03 05:07:04

问题


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

<?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>

回答1:


Have a look at http://blog.neo4j.org/2014/03/spring-data-neo4j-progress-update-sdn-3.html

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.

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

HTH



来源:https://stackoverflow.com/questions/23356398/errors-of-the-cineasts-examples-of-spring-data-neo4j

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!